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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed May 21, 2011 at 23:25 UTC dd555d8bed255c7949620e6551ea5afd2213bae0
1 file changed +12 -11
t/t0021-conversion.sh
+12 -11
@@ -66,25 +66,26 @@ test_expect_success expanded_in_repo '
66 echo "\$Id:NoSpaceAtEitherEnd\$"
67 echo "\$Id: NoTerminatingSymbol"
68 echo "\$Id: Foreign Commit With Spaces \$"
69 - echo "\$Id: NoTerminatingSymbolAtEOF"
69 + printf "\$Id: NoTerminatingSymbolAtEOF"
70 } > expanded-keywords &&
71
72 + git add expanded-keywords &&
73 + git commit -m "File with keywords expanded" &&
74 + id=$(git rev-parse --verify :expanded-keywords) &&
75 +
76 {
77 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 \$"
84 echo "\$Id: NoTerminatingSymbol"
85 echo "\$Id: Foreign Commit With Spaces \$"
82 - echo "\$Id: NoTerminatingSymbolAtEOF"
86 + printf "\$Id: NoTerminatingSymbolAtEOF"
87 } > expected-output &&
88
85 - git add expanded-keywords &&
86 - git commit -m "File with keywords expanded" &&
87 -
89 echo "expanded-keywords ident" >> .gitattributes &&
90
91 rm -f expanded-keywords &&