Skip to content

Commit b4c02c3

Browse files
bedhangergitster
authored andcommitted
t4013: prepare for upcoming "diff --raw --abbrev" output format change
Most of the t4013 tests go through a list of sample command lines, and each of them is executed and its output compared with an expected one stored in t4013/ directory. Allow these lines to begin with a colon followed by magic word(s) so that test conditions can easily be tweaked. The expected use that will happen in later steps of this is to run tests expecting the traditional output and run the same test without the GIT_PRINT_SHA1_ELLIPSIS=yes environment exported for (perhaps some of) them, which will have to expect different output. Since all of the existing tests are meant to run with the environment, use the magic word "noellipses" to cause the variable not to be set and exported. As this step does not add any new test with the magic word, all tests still run with the environment variable, expecting the traditional output, but it will change soon. Based-on-patch-by: Junio C Hamano <[email protected]> Signed-off-by: Ann T Ropea <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ca69d4d commit b4c02c3

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

t/t4013-diff-various.sh

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,37 @@ test_expect_success setup '
118118
EOF
119119

120120
V=$(git version | sed -e 's/^git version //' -e 's/\./\\./g')
121-
while read cmd
121+
while read magic cmd
122122
do
123-
case "$cmd" in
124-
'' | '#'*) continue ;;
123+
case "$magic" in
124+
'' | '#'*)
125+
continue ;;
126+
:*)
127+
magic=${magic#:}
128+
label="$magic-$cmd"
129+
case "$magic" in
130+
noellipses) ;;
131+
*)
132+
die "bug in t4103: unknown magic $magic" ;;
133+
esac ;;
134+
*)
135+
cmd="$magic $cmd" magic=
136+
label="$cmd" ;;
125137
esac
126-
test=$(echo "$cmd" | sed -e 's|[/ ][/ ]*|_|g')
138+
test=$(echo "$label" | sed -e 's|[/ ][/ ]*|_|g')
127139
pfx=$(printf "%04d" $test_count)
128140
expect="$TEST_DIRECTORY/t4013/diff.$test"
129141
actual="$pfx-diff.$test"
130142

131143
test_expect_success "git $cmd" '
132144
{
133-
echo "\$ git $cmd"
134-
GIT_PRINT_SHA1_ELLIPSIS="yes" git $cmd |
145+
echo "$ git $cmd"
146+
case "$magic" in
147+
"")
148+
GIT_PRINT_SHA1_ELLIPSIS=yes git $cmd ;;
149+
noellipses)
150+
git $cmd ;;
151+
esac |
135152
sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \
136153
-e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
137154
echo "\$"

0 commit comments

Comments
 (0)