3 test_description='log/show --expand-tabs'
8 title='tab indent at the beginning of the title line'
9 body='tab indent on a line in the body'
11 # usage: count_expand $indent $numSP $numHT @format_args
15 count=$(( $1 + $2 )) ;# expected spaces
16 while test $count -gt 0
19 count=$(( $count - 1 ))
22 count=$1 ;# expected tabs
23 while test $count -gt 0
26 count=$(( $count - 1 ))
30 # The remainder of the command line is "git show -s" options
38 # Prefix the output with the command line arguments, and
39 # replace SP with a dot both in the expecte and actual output
40 # so that test_cmp would show the differene together with the
41 # breakage in a way easier to consume by the debugging user.
45 } | sed -e 's/ /./g' >expect
50 sed -n -e "/$line\$/p"
51 } | sed -e 's/ /./g' >actual
53 test_cmp expect actual
60 *=raw | *=short | *=email)
71 test_expect_success "expand/no-expand${fmt:+ for $fmt}" '
72 count_expand $in $default $fmt &&
73 count_expand $in 8 0 $fmt --expand-tabs &&
74 count_expand $in 8 0 --expand-tabs $fmt &&
75 count_expand $in 8 0 $fmt --expand-tabs=8 &&
76 count_expand $in 8 0 --expand-tabs=8 $fmt &&
77 count_expand $in 0 1 $fmt --no-expand-tabs &&
78 count_expand $in 0 1 --no-expand-tabs $fmt &&
79 count_expand $in 0 1 $fmt --expand-tabs=0 &&
80 count_expand $in 0 1 --expand-tabs=0 $fmt &&
81 count_expand $in 4 0 $fmt --expand-tabs=4 &&
82 count_expand $in 4 0 --expand-tabs=4 $fmt
86 test_expect_success 'setup' '
88 sed -e "s/Q/$HT/g" <<-EOF >msg &&
93 git commit --allow-empty -F msg
98 test_expand --pretty=short
99 test_expand --pretty=medium
100 test_expand --pretty=full
101 test_expand --pretty=fuller
102 test_expand --pretty=raw
103 test_expand --pretty=email