@@ -11,21 +11,22 @@ prepare_test_file () {
1111 # ! trailing-space
1212 # @ space-before-tab
1313 # # indent-with-non-tab
14+ # % tab-in-indent
1415 sed -e " s/_/ /g" -e " s/>/ /" << -\EOF
1516 An_SP in an ordinary line>and a HT.
16- >A HT.
17- _>A SP and a HT (@).
18- _>_A SP, a HT and a SP (@).
17+ >A HT (%) .
18+ _>A SP and a HT (@% ).
19+ _>_A SP, a HT and a SP (@% ).
1920 _______Seven SP.
2021 ________Eight SP (#).
21- _______>Seven SP and a HT (@).
22- ________>Eight SP and a HT (@#).
23- _______>_Seven SP, a HT and a SP (@).
24- ________>_Eight SP, a HT and a SP (@#).
22+ _______>Seven SP and a HT (@% ).
23+ ________>Eight SP and a HT (@#% ).
24+ _______>_Seven SP, a HT and a SP (@% ).
25+ ________>_Eight SP, a HT and a SP (@#% ).
2526 _______________Fifteen SP (#).
26- _______________>Fifteen SP and a HT (@#).
27+ _______________>Fifteen SP and a HT (@#% ).
2728 ________________Sixteen SP (#).
28- ________________>Sixteen SP and a HT (@#).
29+ ________________>Sixteen SP and a HT (@#% ).
2930 _____a__Five SP, a non WS, two SP.
3031 A line with a (!) trailing SP_
3132 A line with a (!) trailing HT>
@@ -39,7 +40,6 @@ apply_patch () {
3940}
4041
4142test_fix () {
42-
4343 # fix should not barf
4444 apply_patch --whitespace=fix || return 1
4545
130130 for i in - ' '
131131 do
132132 case " $i " in ' ' ) ti=' #' ;; * ) ti= ;; esac
133- rule=${t} trailing,${s} space,${i} indent
134-
135- rm -f .gitattributes
136- test_expect_success " rule=$rule " '
137- git config core.whitespace "$rule" &&
138- test_fix "$tt$ts$ti"
139- '
140-
141- test_expect_success " rule=$rule (attributes)" '
142- git config --unset core.whitespace &&
143- echo "target whitespace=$rule" >.gitattributes &&
144- test_fix "$tt$ts$ti"
145- '
146-
133+ for h in - ' '
134+ do
135+ [ -z " $h$i " ] && continue
136+ case " $h " in ' ' ) th=' %' ;; * ) th= ;; esac
137+ rule=${t} trailing,${s} space,${i} indent,${h} tab
138+
139+ rm -f .gitattributes
140+ test_expect_success " rule=$rule " '
141+ git config core.whitespace "$rule" &&
142+ test_fix "$tt$ts$ti$th"
143+ '
144+
145+ test_expect_success " rule=$rule (attributes)" '
146+ git config --unset core.whitespace &&
147+ echo "target whitespace=$rule" >.gitattributes &&
148+ test_fix "$tt$ts$ti$th"
149+ '
150+
151+ done
147152 done
148153 done
149154done
0 commit comments