Skip to content

Commit dd555d8

Browse files
René Scharfegitster
authored andcommitted
t0021-conversion.sh: fix NoTerminatingSymbolAtEOF test
The last line of the test file "expanded-keywords" ended in a newline, which is a valid terminator for ident. Use printf instead of echo to omit it and thus really test if a file that ends unexpectedly in the middle of an ident tag is handled properly. Also take the oppertunity to calculate the expected ID dynamically instead of hardcoding it into the test script. This should make future changes easier. Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a265a7f commit dd555d8

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

t/t0021-conversion.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,26 @@ test_expect_success expanded_in_repo '
6666
echo "\$Id:NoSpaceAtEitherEnd\$"
6767
echo "\$Id: NoTerminatingSymbol"
6868
echo "\$Id: Foreign Commit With Spaces \$"
69-
echo "\$Id: NoTerminatingSymbolAtEOF"
69+
printf "\$Id: NoTerminatingSymbolAtEOF"
7070
} > expanded-keywords &&
7171
72+
git add expanded-keywords &&
73+
git commit -m "File with keywords expanded" &&
74+
id=$(git rev-parse --verify :expanded-keywords) &&
75+
7276
{
7377
echo "File with expanded keywords"
74-
echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
75-
echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
76-
echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
77-
echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
78-
echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
79-
echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
78+
echo "\$Id: $id \$"
79+
echo "\$Id: $id \$"
80+
echo "\$Id: $id \$"
81+
echo "\$Id: $id \$"
82+
echo "\$Id: $id \$"
83+
echo "\$Id: $id \$"
8084
echo "\$Id: NoTerminatingSymbol"
8185
echo "\$Id: Foreign Commit With Spaces \$"
82-
echo "\$Id: NoTerminatingSymbolAtEOF"
86+
printf "\$Id: NoTerminatingSymbolAtEOF"
8387
} > expected-output &&
8488
85-
git add expanded-keywords &&
86-
git commit -m "File with keywords expanded" &&
87-
8889
echo "expanded-keywords ident" >> .gitattributes &&
8990
9091
rm -f expanded-keywords &&

0 commit comments

Comments
 (0)