Thread (26 messages) flat view 26 messages, 6 authors, 2016-06-16

Re: [PATCH v5 4/4] pretty: test --expand-tabs

From: Eric Sunshine <hidden>
Date: 2016-06-16 02:18:40

Possibly related (same subject, not in this thread)

On Mon, Apr 4, 2016 at 8:58 PM, Junio C Hamano [off-list ref] wrote:
quoted hunk ↗ jump to hunk
The test prepares a simple commit with HT on its log message lines,
and makes sure that

 - formats that should or should not expand tabs by default do or do
   not expand tabs respectively,

 - with explicit --expand-tabs=<N> and short-hands --expand-tabs
   (equivalent to --expand-tabs=8) and --no-expand-tabs (equivalent
   to --expand-tabs=0) before or after the explicit --pretty=$fmt,
   the tabs are expanded (or not expanded) accordingly.

The tests use the second line of the log message for formats other
than --pretty=short, primarily because the first line of the email
format is handled specially to add the [PATCH] prefix, etc. in a
separate codepath (--pretty=short uses the first line because there
is no other line to test).

Signed-off-by: Junio C Hamano <redacted>
---
diff --git a/t/t4213-log-tabexpand.sh b/t/t4213-log-tabexpand.sh
@@ -0,0 +1,98 @@
+count_expand ()
+{
+       case " $* " in
+       *' --pretty=short '*)
+               line=$title ;;
+       *)
+               line=$body ;;
+       esac
+       expect=
+       count=$(( $1 + $2 )) ;# expected spaces
+       while test $count -gt 0
+       do
+               expect="$expect "
+               count=$(( $count - 1 ))
+       done
+       shift 2
+       count=$1 ;# expected tabs
Why semicolon before the hash here and above?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help