提交 bbf08124 编写于 作者: J Jeff King 提交者: Junio C Hamano

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: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 64c0d71c
......@@ -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"
......
......@@ -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' '
......
......@@ -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' '
......
......@@ -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
......
......@@ -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" \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册