]> Pileus Git - ~andy/git/commitdiff
fix bsd shell negation
authorJeff King <peff@peff.net>
Wed, 14 May 2008 04:01:22 +0000 (00:01 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 May 2008 04:44:48 +0000 (21:44 -0700)
On some shells (notably /bin/sh on FreeBSD 6.1), the
construct

  foo && ! bar | baz

is true if

  foo && baz

whereas for most other shells (such as bash) is true if

  foo && ! baz

We can work around this by specifying

  foo && ! (bar | baz)

which works everywhere.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase.sh
t/t3400-rebase.sh
t/t3700-add.sh
t/t5302-pack-index.sh
t/t7501-commit.sh

index 9b13b833cb5762542848ee3e85e23d3ca0f76fa6..fbb0f288b3243bad5c358c6e8ecfb351aeaa52e8 100755 (executable)
@@ -353,7 +353,7 @@ orig_head=$branch
 mb=$(git merge-base "$onto" "$branch")
 if test "$upstream" = "$onto" && test "$mb" = "$onto" &&
        # linear history?
-       ! git rev-list --parents "$onto".."$branch" | grep " .* " > /dev/null
+       ! (git rev-list --parents "$onto".."$branch" | grep " .* ") > /dev/null
 then
        # Lazily switch to the target branch if needed...
        test -z "$switch_to" || git checkout "$switch_to"
index 496f4ec17217769228954116528b0fc0c1ef2a62..fdad7dad611b385f05779826bfa74f33d1f28d03 100755 (executable)
@@ -44,13 +44,13 @@ test_expect_success 'rebase against master' '
 
 test_expect_success \
     'the rebase operation should not have destroyed author information' \
-    '! git log | grep "Author:" | grep "<>"'
+    '! (git log | grep "Author:" | grep "<>")'
 
 test_expect_success 'rebase after merge master' '
      git reset --hard topic &&
      git merge master &&
      git rebase master &&
-     ! git show | grep "^Merge:"
+     ! (git show | grep "^Merge:")
 '
 
 test_expect_success 'rebase of history with merges is linearized' '
index 287e058e3766df129dcde82aeddecac59b46e2a6..68c5ddebdf565912af5f481283980169f069a7a6 100755 (executable)
@@ -81,17 +81,17 @@ test_expect_success '.gitignore test setup' '
 
 test_expect_success '.gitignore is honored' '
        git add . &&
-       ! git ls-files | grep "\\.ig"
+       ! (git ls-files | grep "\\.ig")
 '
 
 test_expect_success 'error out when attempting to add ignored ones without -f' '
        ! git add a.?? &&
-       ! git ls-files | grep "\\.ig"
+       ! (git ls-files | grep "\\.ig")
 '
 
 test_expect_success 'error out when attempting to add ignored ones without -f' '
        ! git add d.?? &&
-       ! git ls-files | grep "\\.ig"
+       ! (git ls-files | grep "\\.ig")
 '
 
 test_expect_success 'add ignored ones with -f' '
index b88b5bbd022bb3dd836d00f88a8e486c00285103..09fd91767297a8c59edb08944740bbcf08f8a7c4 100755 (executable)
@@ -65,7 +65,7 @@ test_expect_success \
 
 have_64bits=
 if msg=$(git verify-pack -v "test-3-${pack3}.pack" 2>&1) ||
-       ! echo "$msg" | grep "pack too large .* off_t"
+       ! (echo "$msg" | grep "pack too large .* off_t")
 then
        have_64bits=t
 else
index c0288f345fb5809d8606f4d3cfaf73d24d6c7281..89710afcb5141beee6b02d8a67e66e11c6f15ad0 100755 (executable)
@@ -41,7 +41,7 @@ test_expect_success \
 test_expect_success \
        "using paths with --interactive" \
        "echo bong-o-bong >file &&
-       ! echo 7 | git-commit -m foo --interactive file"
+       ! (echo 7 | git-commit -m foo --interactive file)"
 
 test_expect_success \
        "using invalid commit with -C" \