t0021-conversion.sh: fix NoTerminatingSymbolAtEOF test
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>
Sat, 21 May 2011 21:25:06 +0000 (23:25 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 26 May 2011 23:47:15 +0000 (16:47 -0700)
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>
t/t0021-conversion.sh
index 9078b84ae68b430285312749f62daee103dcc428..275421e48ecde787bafba8437ef5977fd153a0e2 100755 (executable)
@@ -66,25 +66,26 @@ test_expect_success expanded_in_repo '
                echo "\$Id:NoSpaceAtEitherEnd\$"
                echo "\$Id: NoTerminatingSymbol"
                echo "\$Id: Foreign Commit With Spaces \$"
                echo "\$Id:NoSpaceAtEitherEnd\$"
                echo "\$Id: NoTerminatingSymbol"
                echo "\$Id: Foreign Commit With Spaces \$"
-               echo "\$Id: NoTerminatingSymbolAtEOF"
+               printf "\$Id: NoTerminatingSymbolAtEOF"
        } > expanded-keywords &&
 
        } > expanded-keywords &&
 
+       git add expanded-keywords &&
+       git commit -m "File with keywords expanded" &&
+       id=$(git rev-parse --verify :expanded-keywords) &&
+
        {
                echo "File with expanded keywords"
        {
                echo "File with expanded keywords"
-               echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
-               echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
-               echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
-               echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
-               echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
-               echo "\$Id: fd0478f5f1486f3d5177d4c3f6eb2765e8fc56b9 \$"
+               echo "\$Id: $id \$"
+               echo "\$Id: $id \$"
+               echo "\$Id: $id \$"
+               echo "\$Id: $id \$"
+               echo "\$Id: $id \$"
+               echo "\$Id: $id \$"
                echo "\$Id: NoTerminatingSymbol"
                echo "\$Id: Foreign Commit With Spaces \$"
                echo "\$Id: NoTerminatingSymbol"
                echo "\$Id: Foreign Commit With Spaces \$"
-               echo "\$Id: NoTerminatingSymbolAtEOF"
+               printf "\$Id: NoTerminatingSymbolAtEOF"
        } > expected-output &&
 
        } > expected-output &&
 
-       git add expanded-keywords &&
-       git commit -m "File with keywords expanded" &&
-
        echo "expanded-keywords ident" >> .gitattributes &&
 
        rm -f expanded-keywords &&
        echo "expanded-keywords ident" >> .gitattributes &&
 
        rm -f expanded-keywords &&