]> granicus.if.org Git - cgit/commitdiff
t0108: Avoid unnecessary fork()
authorLukas Fleischer <cgit@cryptocrack.de>
Mon, 26 Aug 2013 18:38:31 +0000 (20:38 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Mon, 26 Aug 2013 19:01:11 +0000 (21:01 +0200)
Use `git rev-list --max-parents=0 HEAD` instead of `git rev-list HEAD |
tail -1` to get the root commit. This works since Git 1.7.4.2.

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
tests/t0108-patch.sh

index 3b5bae44257b40cf655e57e2b20f1afabe7428ad..867d7393d6f0d388055d01d607cae0fd41635b31 100755 (executable)
@@ -24,7 +24,7 @@ test_expect_success 'find `cgit` signature' '
 '
 
 test_expect_success 'find initial commit' '
-       root=$(git --git-dir="$PWD/repos/foo/.git" rev-list HEAD | tail -1)
+       root=$(git --git-dir="$PWD/repos/foo/.git" rev-list --max-parents=0 HEAD)
 '
 
 test_expect_success 'generate patch for initial commit' '