Skip to content

Commit bbf0812

Browse files
peffgitster
authored andcommitted
fix bsd shell negation
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>
1 parent 64c0d71 commit bbf0812

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

git-rebase.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ orig_head=$branch
353353
mb=$(git merge-base "$onto" "$branch")
354354
if test "$upstream" = "$onto" && test "$mb" = "$onto" &&
355355
# linear history?
356-
! git rev-list --parents "$onto".."$branch" | grep " .* " > /dev/null
356+
! (git rev-list --parents "$onto".."$branch" | grep " .* ") > /dev/null
357357
then
358358
# Lazily switch to the target branch if needed...
359359
test -z "$switch_to" || git checkout "$switch_to"

t/t3400-rebase.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ test_expect_success 'rebase against master' '
4444

4545
test_expect_success \
4646
'the rebase operation should not have destroyed author information' \
47-
'! git log | grep "Author:" | grep "<>"'
47+
'! (git log | grep "Author:" | grep "<>")'
4848

4949
test_expect_success 'rebase after merge master' '
5050
git reset --hard topic &&
5151
git merge master &&
5252
git rebase master &&
53-
! git show | grep "^Merge:"
53+
! (git show | grep "^Merge:")
5454
'
5555

5656
test_expect_success 'rebase of history with merges is linearized' '

t/t3700-add.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,17 @@ test_expect_success '.gitignore test setup' '
8181

8282
test_expect_success '.gitignore is honored' '
8383
git add . &&
84-
! git ls-files | grep "\\.ig"
84+
! (git ls-files | grep "\\.ig")
8585
'
8686

8787
test_expect_success 'error out when attempting to add ignored ones without -f' '
8888
! git add a.?? &&
89-
! git ls-files | grep "\\.ig"
89+
! (git ls-files | grep "\\.ig")
9090
'
9191

9292
test_expect_success 'error out when attempting to add ignored ones without -f' '
9393
! git add d.?? &&
94-
! git ls-files | grep "\\.ig"
94+
! (git ls-files | grep "\\.ig")
9595
'
9696

9797
test_expect_success 'add ignored ones with -f' '

t/t5302-pack-index.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ test_expect_success \
6565

6666
have_64bits=
6767
if msg=$(git verify-pack -v "test-3-${pack3}.pack" 2>&1) ||
68-
! echo "$msg" | grep "pack too large .* off_t"
68+
! (echo "$msg" | grep "pack too large .* off_t")
6969
then
7070
have_64bits=t
7171
else

t/t7501-commit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ test_expect_success \
4141
test_expect_success \
4242
"using paths with --interactive" \
4343
"echo bong-o-bong >file &&
44-
! echo 7 | git-commit -m foo --interactive file"
44+
! (echo 7 | git-commit -m foo --interactive file)"
4545

4646
test_expect_success \
4747
"using invalid commit with -C" \

0 commit comments

Comments
 (0)