提交 30db51a3 编写于 作者: J Junio C Hamano

Merge branch 'jk/test-chain-lint'

People often forget to chain the commands in their test together
with &&, leaving a failure from an earlier command in the test go
unnoticed.  The new GIT_TEST_CHAIN_LINT mechanism allows you to
catch such a mistake more easily.

* jk/test-chain-lint: (36 commits)
  t9001: drop save_confirm helper
  t0020: use test_* helpers instead of hand-rolled messages
  t: simplify loop exit-code status variables
  t: fix some trivial cases of ignored exit codes in loops
  t7701: fix ignored exit code inside loop
  t3305: fix ignored exit code inside loop
  t0020: fix ignored exit code inside loops
  perf-lib: fix ignored exit code inside loop
  t6039: fix broken && chain
  t9158, t9161: fix broken &&-chain in git-svn tests
  t9104: fix test for following larger parents
  t4104: drop hand-rolled error reporting
  t0005: fix broken &&-chains
  t7004: fix embedded single-quotes
  t0050: appease --chain-lint
  t9001: use test_when_finished
  t4117: use modern test_* helpers
  t6034: use modern test_* helpers
  t1301: use modern test_* helpers
  t0020: use modern test_* helpers
  ...
...@@ -168,6 +168,16 @@ appropriately before running "make". ...@@ -168,6 +168,16 @@ appropriately before running "make".
Using this option with a RAM-based filesystem (such as tmpfs) Using this option with a RAM-based filesystem (such as tmpfs)
can massively speed up the test suite. can massively speed up the test suite.
--chain-lint::
--no-chain-lint::
If --chain-lint is enabled, the test harness will check each
test to make sure that it properly "&&-chains" all commands (so
that a failure in the middle does not go unnoticed by the final
exit code of the test). This check is performed in addition to
running the tests themselves. You may also enable or disable
this feature by setting the GIT_TEST_CHAIN_LINT environment
variable to "1" or "0", respectively.
You can also set the GIT_TEST_INSTALLED environment variable to You can also set the GIT_TEST_INSTALLED environment variable to
the bindir of an existing git installation to test that installation. the bindir of an existing git installation to test that installation.
You still need to have built this git sandbox, from which various You still need to have built this git sandbox, from which various
......
...@@ -405,7 +405,7 @@ test_expect_success 'setup -L :regex' ' ...@@ -405,7 +405,7 @@ test_expect_success 'setup -L :regex' '
mv hello.c hello.orig && mv hello.c hello.orig &&
echo "#include <stdio.h>" >hello.c && echo "#include <stdio.h>" >hello.c &&
cat hello.orig >>hello.c && cat hello.orig >>hello.c &&
tr Q "\\t" >>hello.c <<-\EOF tr Q "\\t" >>hello.c <<-\EOF &&
void mail() void mail()
{ {
Qputs("mail"); Qputs("mail");
......
...@@ -91,7 +91,7 @@ test_perf_create_repo_from () { ...@@ -91,7 +91,7 @@ test_perf_create_repo_from () {
*/objects|*/hooks|*/config) */objects|*/hooks|*/config)
;; ;;
*) *)
cp -R "$stuff" . || break cp -R "$stuff" . || exit 1
;; ;;
esac esac
done && done &&
......
...@@ -253,7 +253,7 @@ test_expect_success 'test --verbose' ' ...@@ -253,7 +253,7 @@ test_expect_success 'test --verbose' '
test_expect_success "failing test" false test_expect_success "failing test" false
test_done test_done
EOF EOF
mv test-verbose/out test-verbose/out+ mv test-verbose/out test-verbose/out+ &&
grep -v "^Initialized empty" test-verbose/out+ >test-verbose/out && grep -v "^Initialized empty" test-verbose/out+ >test-verbose/out &&
check_sub_test_lib_test test-verbose <<-\EOF check_sub_test_lib_test test-verbose <<-\EOF
> expecting success: true > expecting success: true
...@@ -974,7 +974,7 @@ test_expect_success 'writing this tree with --missing-ok' ' ...@@ -974,7 +974,7 @@ test_expect_success 'writing this tree with --missing-ok' '
################################################################ ################################################################
test_expect_success 'git read-tree followed by write-tree should be idempotent' ' test_expect_success 'git read-tree followed by write-tree should be idempotent' '
rm -f .git/index rm -f .git/index &&
git read-tree $tree && git read-tree $tree &&
test -f .git/index && test -f .git/index &&
newtree=$(git write-tree) && newtree=$(git write-tree) &&
......
...@@ -10,8 +10,8 @@ one ...@@ -10,8 +10,8 @@ one
EOF EOF
test_expect_success 'sigchain works' ' test_expect_success 'sigchain works' '
test-sigchain >actual { test-sigchain >actual; ret=$?; } &&
case "$?" in case "$ret" in
143) true ;; # POSIX w/ SIGTERM=15 143) true ;; # POSIX w/ SIGTERM=15
271) true ;; # ksh w/ SIGTERM=15 271) true ;; # ksh w/ SIGTERM=15
3) true ;; # Windows 3) true ;; # Windows
...@@ -40,12 +40,12 @@ test_expect_success 'create blob' ' ...@@ -40,12 +40,12 @@ test_expect_success 'create blob' '
' '
test_expect_success !MINGW 'a constipated git dies with SIGPIPE' ' test_expect_success !MINGW 'a constipated git dies with SIGPIPE' '
OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&
test "$OUT" -eq 141 test "$OUT" -eq 141
' '
test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' ' test_expect_success !MINGW 'a constipated git dies with SIGPIPE even if parent ignores it' '
OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 ) OUT=$( ((trap "" PIPE; large_git; echo $? 1>&3) | :) 3>&1 ) &&
test "$OUT" -eq 141 test "$OUT" -eq 141
' '
......
...@@ -218,7 +218,7 @@ test_expect_success 'grow / shrink' ' ...@@ -218,7 +218,7 @@ test_expect_success 'grow / shrink' '
echo size >> in && echo size >> in &&
echo 64 51 >> expect && echo 64 51 >> expect &&
echo put key52 value52 >> in && echo put key52 value52 >> in &&
echo NULL >> expect echo NULL >> expect &&
echo size >> in && echo size >> in &&
echo 256 52 >> expect && echo 256 52 >> expect &&
for n in $(test_seq 12) for n in $(test_seq 12)
......
...@@ -8,6 +8,13 @@ has_cr() { ...@@ -8,6 +8,13 @@ has_cr() {
tr '\015' Q <"$1" | grep Q >/dev/null tr '\015' Q <"$1" | grep Q >/dev/null
} }
# add or remove CRs to disk file in-place
# usage: munge_cr <append|remove> <file>
munge_cr () {
"${1}_cr" <"$2" >tmp &&
mv tmp "$2"
}
test_expect_success setup ' test_expect_success setup '
git config core.autocrlf false && git config core.autocrlf false &&
...@@ -28,9 +35,7 @@ test_expect_success setup ' ...@@ -28,9 +35,7 @@ test_expect_success setup '
for w in Some extra lines here; do echo $w; done >>one && for w in Some extra lines here; do echo $w; done >>one &&
git diff >patch.file && git diff >patch.file &&
patched=$(git hash-object --stdin <one) && patched=$(git hash-object --stdin <one) &&
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD
echo happy.
' '
test_expect_success 'safecrlf: autocrlf=input, all CRLF' ' test_expect_success 'safecrlf: autocrlf=input, all CRLF' '
...@@ -100,22 +105,11 @@ test_expect_success 'update with autocrlf=input' ' ...@@ -100,22 +105,11 @@ test_expect_success 'update with autocrlf=input' '
rm -f tmp one dir/two three && rm -f tmp one dir/two three &&
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
git config core.autocrlf input && git config core.autocrlf input &&
munge_cr append one &&
for f in one dir/two munge_cr append dir/two &&
do git update-index -- one dir/two &&
append_cr <$f >tmp && mv -f tmp $f &&
git update-index -- $f || {
echo Oops
false
break
}
done &&
differs=$(git diff-index --cached HEAD) && differs=$(git diff-index --cached HEAD) &&
test -z "$differs" || { verbose test -z "$differs"
echo Oops "$differs"
false
}
' '
...@@ -124,22 +118,11 @@ test_expect_success 'update with autocrlf=true' ' ...@@ -124,22 +118,11 @@ test_expect_success 'update with autocrlf=true' '
rm -f tmp one dir/two three && rm -f tmp one dir/two three &&
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
git config core.autocrlf true && git config core.autocrlf true &&
munge_cr append one &&
for f in one dir/two munge_cr append dir/two &&
do git update-index -- one dir/two &&
append_cr <$f >tmp && mv -f tmp $f &&
git update-index -- $f || {
echo "Oops $f"
false
break
}
done &&
differs=$(git diff-index --cached HEAD) && differs=$(git diff-index --cached HEAD) &&
test -z "$differs" || { verbose test -z "$differs"
echo Oops "$differs"
false
}
' '
...@@ -148,23 +131,13 @@ test_expect_success 'checkout with autocrlf=true' ' ...@@ -148,23 +131,13 @@ test_expect_success 'checkout with autocrlf=true' '
rm -f tmp one dir/two three && rm -f tmp one dir/two three &&
git config core.autocrlf true && git config core.autocrlf true &&
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
munge_cr remove one &&
for f in one dir/two munge_cr remove dir/two &&
do git update-index -- one dir/two &&
remove_cr <"$f" >tmp && mv -f tmp $f &&
git update-index -- $f || {
echo "Eh? $f"
false
break
}
done &&
test "$one" = $(git hash-object --stdin <one) && test "$one" = $(git hash-object --stdin <one) &&
test "$two" = $(git hash-object --stdin <dir/two) && test "$two" = $(git hash-object --stdin <dir/two) &&
differs=$(git diff-index --cached HEAD) && differs=$(git diff-index --cached HEAD) &&
test -z "$differs" || { verbose test -z "$differs"
echo Oops "$differs"
false
}
' '
test_expect_success 'checkout with autocrlf=input' ' test_expect_success 'checkout with autocrlf=input' '
...@@ -172,25 +145,13 @@ test_expect_success 'checkout with autocrlf=input' ' ...@@ -172,25 +145,13 @@ test_expect_success 'checkout with autocrlf=input' '
rm -f tmp one dir/two three && rm -f tmp one dir/two three &&
git config core.autocrlf input && git config core.autocrlf input &&
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
test_must_fail has_cr one &&
for f in one dir/two test_must_fail has_cr two &&
do git update-index -- one dir/two &&
if has_cr "$f"
then
echo "Eh? $f"
false
break
else
git update-index -- $f
fi
done &&
test "$one" = $(git hash-object --stdin <one) && test "$one" = $(git hash-object --stdin <one) &&
test "$two" = $(git hash-object --stdin <dir/two) && test "$two" = $(git hash-object --stdin <dir/two) &&
differs=$(git diff-index --cached HEAD) && differs=$(git diff-index --cached HEAD) &&
test -z "$differs" || { verbose test -z "$differs"
echo Oops "$differs"
false
}
' '
test_expect_success 'apply patch (autocrlf=input)' ' test_expect_success 'apply patch (autocrlf=input)' '
...@@ -200,10 +161,7 @@ test_expect_success 'apply patch (autocrlf=input)' ' ...@@ -200,10 +161,7 @@ test_expect_success 'apply patch (autocrlf=input)' '
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
git apply patch.file && git apply patch.file &&
test "$patched" = "$(git hash-object --stdin <one)" || { verbose test "$patched" = "$(git hash-object --stdin <one)"
echo "Eh? apply without index"
false
}
' '
test_expect_success 'apply patch --cached (autocrlf=input)' ' test_expect_success 'apply patch --cached (autocrlf=input)' '
...@@ -213,10 +171,7 @@ test_expect_success 'apply patch --cached (autocrlf=input)' ' ...@@ -213,10 +171,7 @@ test_expect_success 'apply patch --cached (autocrlf=input)' '
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
git apply --cached patch.file && git apply --cached patch.file &&
test "$patched" = $(git rev-parse :one) || { verbose test "$patched" = $(git rev-parse :one)
echo "Eh? apply with --cached"
false
}
' '
test_expect_success 'apply patch --index (autocrlf=input)' ' test_expect_success 'apply patch --index (autocrlf=input)' '
...@@ -226,11 +181,8 @@ test_expect_success 'apply patch --index (autocrlf=input)' ' ...@@ -226,11 +181,8 @@ test_expect_success 'apply patch --index (autocrlf=input)' '
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
git apply --index patch.file && git apply --index patch.file &&
test "$patched" = $(git rev-parse :one) && verbose test "$patched" = $(git rev-parse :one) &&
test "$patched" = $(git hash-object --stdin <one) || { verbose test "$patched" = $(git hash-object --stdin <one)
echo "Eh? apply with --index"
false
}
' '
test_expect_success 'apply patch (autocrlf=true)' ' test_expect_success 'apply patch (autocrlf=true)' '
...@@ -240,10 +192,7 @@ test_expect_success 'apply patch (autocrlf=true)' ' ...@@ -240,10 +192,7 @@ test_expect_success 'apply patch (autocrlf=true)' '
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
git apply patch.file && git apply patch.file &&
test "$patched" = "$(remove_cr <one | git hash-object --stdin)" || { verbose test "$patched" = "$(remove_cr <one | git hash-object --stdin)"
echo "Eh? apply without index"
false
}
' '
test_expect_success 'apply patch --cached (autocrlf=true)' ' test_expect_success 'apply patch --cached (autocrlf=true)' '
...@@ -253,10 +202,7 @@ test_expect_success 'apply patch --cached (autocrlf=true)' ' ...@@ -253,10 +202,7 @@ test_expect_success 'apply patch --cached (autocrlf=true)' '
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
git apply --cached patch.file && git apply --cached patch.file &&
test "$patched" = $(git rev-parse :one) || { verbose test "$patched" = $(git rev-parse :one)
echo "Eh? apply without index"
false
}
' '
test_expect_success 'apply patch --index (autocrlf=true)' ' test_expect_success 'apply patch --index (autocrlf=true)' '
...@@ -266,11 +212,8 @@ test_expect_success 'apply patch --index (autocrlf=true)' ' ...@@ -266,11 +212,8 @@ test_expect_success 'apply patch --index (autocrlf=true)' '
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
git apply --index patch.file && git apply --index patch.file &&
test "$patched" = $(git rev-parse :one) && verbose test "$patched" = $(git rev-parse :one) &&
test "$patched" = "$(remove_cr <one | git hash-object --stdin)" || { verbose test "$patched" = "$(remove_cr <one | git hash-object --stdin)"
echo "Eh? apply with --index"
false
}
' '
test_expect_success '.gitattributes says two is binary' ' test_expect_success '.gitattributes says two is binary' '
...@@ -280,29 +223,9 @@ test_expect_success '.gitattributes says two is binary' ' ...@@ -280,29 +223,9 @@ test_expect_success '.gitattributes says two is binary' '
git config core.autocrlf true && git config core.autocrlf true &&
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
if has_cr dir/two test_must_fail has_cr dir/two &&
then verbose has_cr one &&
echo "Huh?" test_must_fail has_cr three
false
else
: happy
fi &&
if has_cr one
then
: happy
else
echo "Huh?"
false
fi &&
if has_cr three
then
echo "Huh?"
false
else
: happy
fi
' '
test_expect_success '.gitattributes says two is input' ' test_expect_success '.gitattributes says two is input' '
...@@ -311,13 +234,7 @@ test_expect_success '.gitattributes says two is input' ' ...@@ -311,13 +234,7 @@ test_expect_success '.gitattributes says two is input' '
echo "two crlf=input" >.gitattributes && echo "two crlf=input" >.gitattributes &&
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
if has_cr dir/two test_must_fail has_cr dir/two
then
echo "Huh?"
false
else
: happy
fi
' '
test_expect_success '.gitattributes says two and three are text' ' test_expect_success '.gitattributes says two and three are text' '
...@@ -326,21 +243,8 @@ test_expect_success '.gitattributes says two and three are text' ' ...@@ -326,21 +243,8 @@ test_expect_success '.gitattributes says two and three are text' '
echo "t* crlf" >.gitattributes && echo "t* crlf" >.gitattributes &&
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
if has_cr dir/two verbose has_cr dir/two &&
then verbose has_cr three
: happy
else
echo "Huh?"
false
fi &&
if has_cr three
then
: happy
else
echo "Huh?"
false
fi
' '
test_expect_success 'in-tree .gitattributes (1)' ' test_expect_success 'in-tree .gitattributes (1)' '
...@@ -352,17 +256,8 @@ test_expect_success 'in-tree .gitattributes (1)' ' ...@@ -352,17 +256,8 @@ test_expect_success 'in-tree .gitattributes (1)' '
rm -rf tmp one dir .gitattributes patch.file three && rm -rf tmp one dir .gitattributes patch.file three &&
git read-tree --reset -u HEAD && git read-tree --reset -u HEAD &&
if has_cr one test_must_fail has_cr one &&
then verbose has_cr three
echo "Eh? one should not have CRLF"
false
else
: happy
fi &&
has_cr three || {
echo "Eh? three should still have CRLF"
false
}
' '
test_expect_success 'in-tree .gitattributes (2)' ' test_expect_success 'in-tree .gitattributes (2)' '
...@@ -371,17 +266,8 @@ test_expect_success 'in-tree .gitattributes (2)' ' ...@@ -371,17 +266,8 @@ test_expect_success 'in-tree .gitattributes (2)' '
git read-tree --reset HEAD && git read-tree --reset HEAD &&
git checkout-index -f -q -u -a && git checkout-index -f -q -u -a &&
if has_cr one test_must_fail has_cr one &&
then verbose has_cr three
echo "Eh? one should not have CRLF"
false
else
: happy
fi &&
has_cr three || {
echo "Eh? three should still have CRLF"
false
}
' '
test_expect_success 'in-tree .gitattributes (3)' ' test_expect_success 'in-tree .gitattributes (3)' '
...@@ -391,17 +277,8 @@ test_expect_success 'in-tree .gitattributes (3)' ' ...@@ -391,17 +277,8 @@ test_expect_success 'in-tree .gitattributes (3)' '
git checkout-index -u .gitattributes && git checkout-index -u .gitattributes &&
git checkout-index -u one dir/two three && git checkout-index -u one dir/two three &&
if has_cr one test_must_fail has_cr one &&
then verbose has_cr three
echo "Eh? one should not have CRLF"
false
else
: happy
fi &&
has_cr three || {
echo "Eh? three should still have CRLF"
false
}
' '
test_expect_success 'in-tree .gitattributes (4)' ' test_expect_success 'in-tree .gitattributes (4)' '
...@@ -411,17 +288,8 @@ test_expect_success 'in-tree .gitattributes (4)' ' ...@@ -411,17 +288,8 @@ test_expect_success 'in-tree .gitattributes (4)' '
git checkout-index -u one dir/two three && git checkout-index -u one dir/two three &&
git checkout-index -u .gitattributes && git checkout-index -u .gitattributes &&
if has_cr one test_must_fail has_cr one &&
then verbose has_cr three
echo "Eh? one should not have CRLF"
false
else
: happy
fi &&
has_cr three || {
echo "Eh? three should still have CRLF"
false
}
' '
test_expect_success 'checkout with existing .gitattributes' ' test_expect_success 'checkout with existing .gitattributes' '
......
...@@ -172,12 +172,9 @@ test_expect_success 'long options' ' ...@@ -172,12 +172,9 @@ test_expect_success 'long options' '
' '
test_expect_success 'missing required value' ' test_expect_success 'missing required value' '
test-parse-options -s; test_expect_code 129 test-parse-options -s &&
test $? = 129 && test_expect_code 129 test-parse-options --string &&
test-parse-options --string; test_expect_code 129 test-parse-options --file
test $? = 129 &&
test-parse-options --file;
test $? = 129
' '
cat > expect << EOF cat > expect << EOF
...@@ -227,8 +224,7 @@ test_expect_success 'unambiguously abbreviated option with "="' ' ...@@ -227,8 +224,7 @@ test_expect_success 'unambiguously abbreviated option with "="' '
' '
test_expect_success 'ambiguously abbreviated option' ' test_expect_success 'ambiguously abbreviated option' '
test-parse-options --strin 123; test_expect_code 129 test-parse-options --strin 123
test $? = 129
' '
cat > expect << EOF cat > expect << EOF
......
...@@ -33,16 +33,20 @@ test_expect_success "detection of case insensitive filesystem during repo init" ...@@ -33,16 +33,20 @@ test_expect_success "detection of case insensitive filesystem during repo init"
' '
else else
test_expect_success "detection of case insensitive filesystem during repo init" ' test_expect_success "detection of case insensitive filesystem during repo init" '
test_must_fail git config --bool core.ignorecase >/dev/null || {
test $(git config --bool core.ignorecase) = false test_must_fail git config --bool core.ignorecase >/dev/null ||
test $(git config --bool core.ignorecase) = false
}
' '
fi fi
if test_have_prereq SYMLINKS if test_have_prereq SYMLINKS
then then
test_expect_success "detection of filesystem w/o symlink support during repo init" ' test_expect_success "detection of filesystem w/o symlink support during repo init" '
test_must_fail git config --bool core.symlinks || {
test "$(git config --bool core.symlinks)" = true test_must_fail git config --bool core.symlinks ||
test "$(git config --bool core.symlinks)" = true
}
' '
else else
test_expect_success "detection of filesystem w/o symlink support during repo init" ' test_expect_success "detection of filesystem w/o symlink support during repo init" '
......
...@@ -26,7 +26,7 @@ test_expect_success 'setup' ' ...@@ -26,7 +26,7 @@ test_expect_success 'setup' '
' '
test_expect_success 'revision walking can be done twice' ' test_expect_success 'revision walking can be done twice' '
test-revision-walking run-twice > run_twice_actual test-revision-walking run-twice >run_twice_actual &&
test_cmp run_twice_expected run_twice_actual test_cmp run_twice_expected run_twice_actual
' '
......
...@@ -50,17 +50,17 @@ test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate v ...@@ -50,17 +50,17 @@ test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate v
test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces' ' test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces' '
cmdline="git am" && cmdline="git am" &&
export cmdline; export cmdline &&
printf "When you have resolved this problem, run git am --resolved." >expect && printf "When you have resolved this problem, run git am --resolved." >expect &&
eval_gettext "When you have resolved this problem, run \$cmdline --resolved." >actual eval_gettext "When you have resolved this problem, run \$cmdline --resolved." >actual &&
test_i18ncmp expect actual test_i18ncmp expect actual
' '
test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces and quotes' ' test_expect_success 'eval_gettext: our eval_gettext() fallback can interpolate variables with spaces and quotes' '
cmdline="git am" && cmdline="git am" &&
export cmdline; export cmdline &&
printf "When you have resolved this problem, run \"git am --resolved\"." >expect && printf "When you have resolved this problem, run \"git am --resolved\"." >expect &&
eval_gettext "When you have resolved this problem, run \"\$cmdline --resolved\"." >actual eval_gettext "When you have resolved this problem, run \"\$cmdline --resolved\"." >actual &&
test_i18ncmp expect actual test_i18ncmp expect actual
' '
......
...@@ -75,8 +75,8 @@ test_expect_success \ ...@@ -75,8 +75,8 @@ test_expect_success \
echo yomin >yomin && echo yomin >yomin &&
git update-index --add yomin && git update-index --add yomin &&
read_tree_u_must_succeed -m -u $treeH $treeM && read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >4.out || return 1 git ls-files --stage >4.out &&
git diff -U0 --no-index M.out 4.out >4diff.out test_might_fail git diff -U0 --no-index M.out 4.out >4diff.out &&
compare_change 4diff.out expected && compare_change 4diff.out expected &&
check_cache_at yomin clean && check_cache_at yomin clean &&
sum bozbar frotz nitfol >actual4.sum && sum bozbar frotz nitfol >actual4.sum &&
...@@ -94,8 +94,8 @@ test_expect_success \ ...@@ -94,8 +94,8 @@ test_expect_success \
git update-index --add yomin && git update-index --add yomin &&
echo yomin yomin >yomin && echo yomin yomin >yomin &&
read_tree_u_must_succeed -m -u $treeH $treeM && read_tree_u_must_succeed -m -u $treeH $treeM &&
git ls-files --stage >5.out || return 1 git ls-files --stage >5.out &&
git diff -U0 --no-index M.out 5.out >5diff.out test_might_fail git diff -U0 --no-index M.out 5.out >5diff.out &&
compare_change 5diff.out expected && compare_change 5diff.out expected &&
check_cache_at yomin dirty && check_cache_at yomin dirty &&
sum bozbar frotz nitfol >actual5.sum && sum bozbar frotz nitfol >actual5.sum &&
......
...@@ -274,7 +274,7 @@ test_expect_success 'setup blobs which are likely to delta' ' ...@@ -274,7 +274,7 @@ test_expect_success 'setup blobs which are likely to delta' '
' '
test_expect_success 'confirm that neither loose blob is a delta' ' test_expect_success 'confirm that neither loose blob is a delta' '
cat >expect <<-EOF cat >expect <<-EOF &&
$_z40 $_z40
$_z40 $_z40
EOF EOF
......
...@@ -677,7 +677,7 @@ test_expect_success 'invalid unit' ' ...@@ -677,7 +677,7 @@ test_expect_success 'invalid unit' '
echo 1auto >expect && echo 1auto >expect &&
git config aninvalid.unit >actual && git config aninvalid.unit >actual &&
test_cmp expect actual && test_cmp expect actual &&
cat >expect <<-\EOF cat >expect <<-\EOF &&
fatal: bad numeric config value '\''1auto'\'' for '\''aninvalid.unit'\'' in .git/config: invalid unit fatal: bad numeric config value '\''1auto'\'' for '\''aninvalid.unit'\'' in .git/config: invalid unit
EOF EOF
test_must_fail git config --int --get aninvalid.unit 2>actual && test_must_fail git config --int --get aninvalid.unit 2>actual &&
...@@ -1165,7 +1165,7 @@ test_expect_failure 'adding a key into an empty section reuses header' ' ...@@ -1165,7 +1165,7 @@ test_expect_failure 'adding a key into an empty section reuses header' '
Qkey = value Qkey = value
EOF EOF
git config section.key value git config section.key value &&
test_cmp expect .git/config test_cmp expect .git/config
' '
......
...@@ -12,12 +12,11 @@ setfacl -k . 2>/dev/null ...@@ -12,12 +12,11 @@ setfacl -k . 2>/dev/null
# User must have read permissions to the repo -> failure on --shared=0400 # User must have read permissions to the repo -> failure on --shared=0400
test_expect_success 'shared = 0400 (faulty permission u-w)' ' test_expect_success 'shared = 0400 (faulty permission u-w)' '
test_when_finished "rm -rf sub" &&
mkdir sub && ( mkdir sub && (
cd sub && git init --shared=0400 cd sub &&
test_must_fail git init --shared=0400
) )
ret="$?"
rm -rf sub
test $ret != "0"
' '
modebits () { modebits () {
...@@ -33,7 +32,7 @@ do ...@@ -33,7 +32,7 @@ do
git init --shared=1 && git init --shared=1 &&
test 1 = "$(git config core.sharedrepository)" test 1 = "$(git config core.sharedrepository)"
) && ) &&
actual=$(ls -l sub/.git/HEAD) actual=$(ls -l sub/.git/HEAD) &&
case "$actual" in case "$actual" in
-rw-rw-r--*) -rw-rw-r--*)
: happy : happy
...@@ -90,10 +89,8 @@ do ...@@ -90,10 +89,8 @@ do
rm -f .git/info/refs && rm -f .git/info/refs &&
git update-server-info && git update-server-info &&
actual="$(modebits .git/info/refs)" && actual="$(modebits .git/info/refs)" &&
test "x$actual" = "x-$y" || { verbose test "x$actual" = "x-$y"
ls -lt .git/info
false
}
' '
umask 077 && umask 077 &&
...@@ -102,10 +99,7 @@ do ...@@ -102,10 +99,7 @@ do
rm -f .git/info/refs && rm -f .git/info/refs &&
git update-server-info && git update-server-info &&
actual="$(modebits .git/info/refs)" && actual="$(modebits .git/info/refs)" &&
test "x$actual" = "x-$x" || { verbose test "x$actual" = "x-$x"
ls -lt .git/info
false
}
' '
......
...@@ -28,7 +28,7 @@ test_expect_success 'show-ref' ' ...@@ -28,7 +28,7 @@ test_expect_success 'show-ref' '
>expect && >expect &&
test_must_fail git show-ref D >actual test_must_fail git show-ref D >actual &&
test_cmp expect actual test_cmp expect actual
' '
...@@ -62,7 +62,7 @@ test_expect_success 'show-ref --verify' ' ...@@ -62,7 +62,7 @@ test_expect_success 'show-ref --verify' '
test_must_fail git show-ref --verify tags/A >actual && test_must_fail git show-ref --verify tags/A >actual &&
test_cmp expect actual && test_cmp expect actual &&
test_must_fail git show-ref --verify D >actual test_must_fail git show-ref --verify D >actual &&
test_cmp expect actual test_cmp expect actual
' '
...@@ -78,7 +78,7 @@ test_expect_success 'show-ref --verify -q' ' ...@@ -78,7 +78,7 @@ test_expect_success 'show-ref --verify -q' '
test_must_fail git show-ref --verify -q tags/A >actual && test_must_fail git show-ref --verify -q tags/A >actual &&
test_cmp expect actual && test_cmp expect actual &&
test_must_fail git show-ref --verify -q D >actual test_must_fail git show-ref --verify -q D >actual &&
test_cmp expect actual test_cmp expect actual
' '
...@@ -105,10 +105,10 @@ test_expect_success 'show-ref -d' ' ...@@ -105,10 +105,10 @@ test_expect_success 'show-ref -d' '
test_cmp expect actual && test_cmp expect actual &&
git show-ref -d refs/heads/master >actual && git show-ref -d refs/heads/master >actual &&
test_cmp expect actual test_cmp expect actual &&
git show-ref -d --verify refs/heads/master >actual && git show-ref -d --verify refs/heads/master >actual &&
test_cmp expect actual test_cmp expect actual &&
>expect && >expect &&
......
...@@ -191,7 +191,7 @@ test_expect_success 'unify index, two files remain' ' ...@@ -191,7 +191,7 @@ test_expect_success 'unify index, two files remain' '
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 one 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 one
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 two 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0 two
EOF EOF
test_cmp ls-files.expect ls-files.actual test_cmp ls-files.expect ls-files.actual &&
test-dump-split-index .git/index | sed "/^own/d" >actual && test-dump-split-index .git/index | sed "/^own/d" >actual &&
cat >expect <<EOF && cat >expect <<EOF &&
......
...@@ -294,7 +294,7 @@ one/a.1 ...@@ -294,7 +294,7 @@ one/a.1
one/two/a.1 one/two/a.1
three/a.1 three/a.1
EOF EOF
git ls-files -o -i --exclude "**/a.1" >actual git ls-files -o -i --exclude "**/a.1" >actual &&
test_cmp expect actual test_cmp expect actual
' '
......
...@@ -55,14 +55,11 @@ test_expect_success 'git update-index --add to add various paths.' ' ...@@ -55,14 +55,11 @@ test_expect_success 'git update-index --add to add various paths.' '
: >path9 && : >path9 &&
date >path10 && date >path10 &&
git update-index --add -- path0 path?/file? pathx/ju path7 path8 path9 path10 && git update-index --add -- path0 path?/file? pathx/ju path7 path8 path9 path10 &&
for i in 1 2 git init submod1 &&
do git -C submod1 commit --allow-empty -m "empty 1" &&
git init submod$i && git init submod2 &&
( git -C submod2 commit --allow-empty -m "empty 2" &&
cd submod$i && git commit --allow-empty -m "empty $i" git update-index --add submod[12] &&
) || break
done &&
git update-index --add submod[12]
( (
cd submod1 && cd submod1 &&
git commit --allow-empty -m "empty 1 (updated)" git commit --allow-empty -m "empty 1 (updated)"
...@@ -99,12 +96,12 @@ test_expect_success 'git ls-files -k to show killed files.' ' ...@@ -99,12 +96,12 @@ test_expect_success 'git ls-files -k to show killed files.' '
' '
test_expect_success 'git ls-files -k output (w/o icase)' ' test_expect_success 'git ls-files -k output (w/o icase)' '
git ls-files -k >.output git ls-files -k >.output &&
test_cmp .expected .output test_cmp .expected .output
' '
test_expect_success 'git ls-files -k output (w/ icase)' ' test_expect_success 'git ls-files -k output (w/ icase)' '
git -c core.ignorecase=true ls-files -k >.output git -c core.ignorecase=true ls-files -k >.output &&
test_cmp .expected .output test_cmp .expected .output
' '
......
...@@ -32,7 +32,7 @@ test_expect_success 'setup repo with criss-cross history' ' ...@@ -32,7 +32,7 @@ test_expect_success 'setup repo with criss-cross history' '
do do
echo $n > data/$n && echo $n > data/$n &&
n=$(($n+1)) || n=$(($n+1)) ||
break return 1
done && done &&
# check them in # check them in
......
...@@ -18,22 +18,16 @@ test_expect_success setup ' ...@@ -18,22 +18,16 @@ test_expect_success setup '
echo file >expected && echo file >expected &&
mkdir sub && mkdir sub &&
bad= &&
for n in 0 1 2 3 4 5 for n in 0 1 2 3 4 5
do do
for m in 0 1 2 3 4 5 6 7 8 9 for m in 0 1 2 3 4 5 6 7 8 9
do do
num=00$n$m && num=00$n$m &&
>sub/file-$num && >sub/file-$num &&
echo file-$num >>expected || { echo file-$num >>expected ||
bad=t return 1
break done
} done &&
done && test -z "$bad" || {
bad=t
break
}
done && test -z "$bad" &&
git add . && git add . &&
git commit -m "add a bunch of files" && git commit -m "add a bunch of files" &&
......
...@@ -19,7 +19,7 @@ test_expect_success 'setup' ' ...@@ -19,7 +19,7 @@ test_expect_success 'setup' '
> file$i && > file$i &&
git add file$i && git add file$i &&
test_tick && test_tick &&
git commit -m branch$i || break git commit -m branch$i || return 1
done done
' '
......
...@@ -51,15 +51,12 @@ test_expect_success 'deleting most notes with git-notes' ' ...@@ -51,15 +51,12 @@ test_expect_success 'deleting most notes with git-notes' '
num_notes=250 && num_notes=250 &&
i=0 && i=0 &&
git rev-list HEAD | git rev-list HEAD |
while read sha1 while test $i -lt $num_notes && read sha1
do do
i=$(($i + 1)) && i=$(($i + 1)) &&
if test $i -gt $num_notes
then
break
fi &&
test_tick && test_tick &&
git notes remove "$sha1" git notes remove "$sha1" ||
exit 1
done done
' '
......
...@@ -950,7 +950,7 @@ test_expect_success 'rebase --edit-todo can be used to modify todo' ' ...@@ -950,7 +950,7 @@ test_expect_success 'rebase --edit-todo can be used to modify todo' '
set_fake_editor && set_fake_editor &&
FAKE_LINES="edit 1 2 3" git rebase -i HEAD~3 && FAKE_LINES="edit 1 2 3" git rebase -i HEAD~3 &&
FAKE_LINES="2 1" git rebase --edit-todo && FAKE_LINES="2 1" git rebase --edit-todo &&
git rebase --continue git rebase --continue &&
test M = $(git cat-file commit HEAD^ | sed -ne \$p) && test M = $(git cat-file commit HEAD^ | sed -ne \$p) &&
test L = $(git cat-file commit HEAD | sed -ne \$p) test L = $(git cat-file commit HEAD | sed -ne \$p)
' '
...@@ -1007,7 +1007,7 @@ test_expect_success 'rebase -i with --strategy and -X' ' ...@@ -1007,7 +1007,7 @@ test_expect_success 'rebase -i with --strategy and -X' '
' '
test_expect_success 'rebase -i error on commits with \ in message' ' test_expect_success 'rebase -i error on commits with \ in message' '
current_head=$(git rev-parse HEAD) current_head=$(git rev-parse HEAD) &&
test_when_finished "git rebase --abort; git reset --hard $current_head; rm -f error" && test_when_finished "git rebase --abort; git reset --hard $current_head; rm -f error" &&
test_commit TO-REMOVE will-conflict old-content && test_commit TO-REMOVE will-conflict old-content &&
test_commit "\temp" will-conflict new-content dummy && test_commit "\temp" will-conflict new-content dummy &&
......
...@@ -24,7 +24,7 @@ test_expect_success setup ' ...@@ -24,7 +24,7 @@ test_expect_success setup '
git add file1 file2 && git add file1 file2 &&
test_tick && test_tick &&
git commit -m "Initial commit" && git commit -m "Initial commit" &&
git branch diff-in-message git branch diff-in-message &&
git checkout -b multi-line-subject && git checkout -b multi-line-subject &&
cat F >file2 && cat F >file2 &&
...@@ -36,7 +36,7 @@ test_expect_success setup ' ...@@ -36,7 +36,7 @@ test_expect_success setup '
git checkout diff-in-message && git checkout diff-in-message &&
echo "commit log message containing a diff" >G && echo "commit log message containing a diff" >G &&
echo "" >>G echo "" >>G &&
cat G >file2 && cat G >file2 &&
git add file2 && git add file2 &&
git diff --cached >>G && git diff --cached >>G &&
......
...@@ -24,7 +24,7 @@ test_expect_success 'setup of non-linear-history' ' ...@@ -24,7 +24,7 @@ test_expect_success 'setup of non-linear-history' '
test_commit c && test_commit c &&
git checkout b && git checkout b &&
test_commit d && test_commit d &&
test_commit e test_commit e &&
git checkout c && git checkout c &&
test_commit g && test_commit g &&
...@@ -33,7 +33,7 @@ test_expect_success 'setup of non-linear-history' ' ...@@ -33,7 +33,7 @@ test_expect_success 'setup of non-linear-history' '
cherry_pick gp g && cherry_pick gp g &&
test_commit i && test_commit i &&
git checkout b && git checkout b &&
test_commit f test_commit f &&
git checkout d && git checkout d &&
test_commit n && test_commit n &&
......
...@@ -38,37 +38,37 @@ test_expect_success \ ...@@ -38,37 +38,37 @@ test_expect_success \
test_expect_success \ test_expect_success \
'Test that git rm --cached foo succeeds if the index matches the file' \ 'Test that git rm --cached foo succeeds if the index matches the file' \
'echo content > foo 'echo content >foo &&
git add foo git add foo &&
git rm --cached foo' git rm --cached foo'
test_expect_success \ test_expect_success \
'Test that git rm --cached foo succeeds if the index matches the file' \ 'Test that git rm --cached foo succeeds if the index matches the file' \
'echo content > foo 'echo content >foo &&
git add foo git add foo &&
git commit -m foo git commit -m foo &&
echo "other content" > foo echo "other content" >foo &&
git rm --cached foo' git rm --cached foo'
test_expect_success \ test_expect_success \
'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' ' 'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' '
echo content > foo echo content >foo &&
git add foo git add foo &&
git commit -m foo git commit -m foo --allow-empty &&
echo "other content" > foo echo "other content" >foo &&
git add foo git add foo &&
echo "yet another content" > foo echo "yet another content" >foo &&
test_must_fail git rm --cached foo test_must_fail git rm --cached foo
' '
test_expect_success \ test_expect_success \
'Test that git rm --cached -f foo works in case where --cached only did not' \ 'Test that git rm --cached -f foo works in case where --cached only did not' \
'echo content > foo 'echo content >foo &&
git add foo git add foo &&
git commit -m foo git commit -m foo --allow-empty &&
echo "other content" > foo echo "other content" >foo &&
git add foo git add foo &&
echo "yet another content" > foo echo "yet another content" >foo &&
git rm --cached -f foo' git rm --cached -f foo'
test_expect_success \ test_expect_success \
...@@ -170,7 +170,7 @@ test_expect_success 'but with -f it should work.' ' ...@@ -170,7 +170,7 @@ test_expect_success 'but with -f it should work.' '
git rm -f foo baz && git rm -f foo baz &&
test ! -f foo && test ! -f foo &&
test ! -f baz && test ! -f baz &&
test_must_fail git ls-files --error-unmatch foo test_must_fail git ls-files --error-unmatch foo &&
test_must_fail git ls-files --error-unmatch baz test_must_fail git ls-files --error-unmatch baz
' '
...@@ -183,7 +183,7 @@ test_expect_success 'refuse to remove cached empty file with modifications' ' ...@@ -183,7 +183,7 @@ test_expect_success 'refuse to remove cached empty file with modifications' '
test_expect_success 'remove intent-to-add file without --force' ' test_expect_success 'remove intent-to-add file without --force' '
echo content >intent-to-add && echo content >intent-to-add &&
git add -N intent-to-add git add -N intent-to-add &&
git rm --cached intent-to-add git rm --cached intent-to-add
' '
...@@ -201,7 +201,7 @@ test_expect_success 'Recursive without -r fails' ' ...@@ -201,7 +201,7 @@ test_expect_success 'Recursive without -r fails' '
' '
test_expect_success 'Recursive with -r but dirty' ' test_expect_success 'Recursive with -r but dirty' '
echo qfwfq >>frotz/nitfol echo qfwfq >>frotz/nitfol &&
test_must_fail git rm -r frotz && test_must_fail git rm -r frotz &&
test -d frotz && test -d frotz &&
test -f frotz/nitfol test -f frotz/nitfol
......
...@@ -9,7 +9,7 @@ test_description='i18n settings and format-patch | am pipe' ...@@ -9,7 +9,7 @@ test_description='i18n settings and format-patch | am pipe'
check_encoding () { check_encoding () {
# Make sure characters are not corrupted # Make sure characters are not corrupted
cnt="$1" header="$2" i=1 j=0 bad=0 cnt="$1" header="$2" i=1 j=0
while test "$i" -le $cnt while test "$i" -le $cnt
do do
git format-patch --encoding=UTF-8 --stdout HEAD~$i..HEAD~$j | git format-patch --encoding=UTF-8 --stdout HEAD~$i..HEAD~$j |
...@@ -20,14 +20,10 @@ check_encoding () { ...@@ -20,14 +20,10 @@ check_encoding () {
grep "^encoding ISO8859-1" ;; grep "^encoding ISO8859-1" ;;
*) *)
grep "^encoding ISO8859-1"; test "$?" != 0 ;; grep "^encoding ISO8859-1"; test "$?" != 0 ;;
esac || { esac || return 1
bad=1
break
}
j=$i j=$i
i=$(($i+1)) i=$(($i+1))
done done
(exit $bad)
} }
test_expect_success setup ' test_expect_success setup '
......
...@@ -802,7 +802,7 @@ test_expect_success '--no-signature suppresses format.signaturefile ' ' ...@@ -802,7 +802,7 @@ test_expect_success '--no-signature suppresses format.signaturefile ' '
' '
test_expect_success '--signature-file overrides format.signaturefile' ' test_expect_success '--signature-file overrides format.signaturefile' '
cat >other-mail-signature <<-\EOF cat >other-mail-signature <<-\EOF &&
Use this other signature instead of mail-signature. Use this other signature instead of mail-signature.
EOF EOF
test_config format.signaturefile mail-signature && test_config format.signaturefile mail-signature &&
......
...@@ -20,10 +20,7 @@ test_expect_success setup ' ...@@ -20,10 +20,7 @@ test_expect_success setup '
test_expect_success 'detect rewrite' ' test_expect_success 'detect rewrite' '
actual=$(git diff-files -B --summary test) && actual=$(git diff-files -B --summary test) &&
expr "$actual" : " rewrite test ([0-9]*%)$" || { verbose expr "$actual" : " rewrite test ([0-9]*%)$"
echo "Eh? <<$actual>>"
false
}
' '
......
...@@ -139,7 +139,7 @@ test_expect_success setup ' ...@@ -139,7 +139,7 @@ test_expect_success setup '
( printf C; zs $n ) >file-c$n && ( printf C; zs $n ) >file-c$n &&
( echo D; zs $n ) >file-d$n && ( echo D; zs $n ) >file-d$n &&
expect_pattern $n || break expect_pattern $n || return 1
done >expect done >expect
' '
......
...@@ -111,9 +111,9 @@ test_expect_success 'unknown color slots are ignored (branch)' ' ...@@ -111,9 +111,9 @@ test_expect_success 'unknown color slots are ignored (branch)' '
' '
test_expect_success 'unknown color slots are ignored (status)' ' test_expect_success 'unknown color slots are ignored (status)' '
git config color.status.nosuchslotwilleverbedefined white || exit git config color.status.nosuchslotwilleverbedefined white &&
git status { git status; ret=$?; } &&
case $? in 0|1) : ok ;; *) false ;; esac case $ret in 0|1) : ok ;; *) false ;; esac
' '
test_done test_done
...@@ -29,67 +29,65 @@ test_expect_success 'setup' ' ...@@ -29,67 +29,65 @@ test_expect_success 'setup' '
' '
test_expect_success 'git diff-tree HEAD^ HEAD' ' test_expect_success 'git diff-tree HEAD^ HEAD' '
git diff-tree --quiet HEAD^ HEAD >cnt test_expect_code 1 git diff-tree --quiet HEAD^ HEAD >cnt &&
test $? = 1 && test_line_count = 0 cnt test_line_count = 0 cnt
' '
test_expect_success 'git diff-tree HEAD^ HEAD -- a' ' test_expect_success 'git diff-tree HEAD^ HEAD -- a' '
git diff-tree --quiet HEAD^ HEAD -- a >cnt test_expect_code 0 git diff-tree --quiet HEAD^ HEAD -- a >cnt &&
test $? = 0 && test_line_count = 0 cnt test_line_count = 0 cnt
' '
test_expect_success 'git diff-tree HEAD^ HEAD -- b' ' test_expect_success 'git diff-tree HEAD^ HEAD -- b' '
git diff-tree --quiet HEAD^ HEAD -- b >cnt test_expect_code 1 git diff-tree --quiet HEAD^ HEAD -- b >cnt &&
test $? = 1 && test_line_count = 0 cnt test_line_count = 0 cnt
' '
# this diff outputs one line: sha1 of the given head # this diff outputs one line: sha1 of the given head
test_expect_success 'echo HEAD | git diff-tree --stdin' ' test_expect_success 'echo HEAD | git diff-tree --stdin' '
echo $(git rev-parse HEAD) | git diff-tree --quiet --stdin >cnt echo $(git rev-parse HEAD) |
test $? = 1 && test_line_count = 1 cnt test_expect_code 1 git diff-tree --quiet --stdin >cnt &&
test_line_count = 1 cnt
' '
test_expect_success 'git diff-tree HEAD HEAD' ' test_expect_success 'git diff-tree HEAD HEAD' '
git diff-tree --quiet HEAD HEAD >cnt test_expect_code 0 git diff-tree --quiet HEAD HEAD >cnt &&
test $? = 0 && test_line_count = 0 cnt test_line_count = 0 cnt
' '
test_expect_success 'git diff-files' ' test_expect_success 'git diff-files' '
git diff-files --quiet >cnt test_expect_code 0 git diff-files --quiet >cnt &&
test $? = 0 && test_line_count = 0 cnt test_line_count = 0 cnt
' '
test_expect_success 'git diff-index --cached HEAD' ' test_expect_success 'git diff-index --cached HEAD' '
git diff-index --quiet --cached HEAD >cnt test_expect_code 0 git diff-index --quiet --cached HEAD >cnt &&
test $? = 0 && test_line_count = 0 cnt test_line_count = 0 cnt
' '
test_expect_success 'git diff-index --cached HEAD^' ' test_expect_success 'git diff-index --cached HEAD^' '
git diff-index --quiet --cached HEAD^ >cnt test_expect_code 1 git diff-index --quiet --cached HEAD^ >cnt &&
test $? = 1 && test_line_count = 0 cnt test_line_count = 0 cnt
' '
test_expect_success 'git diff-index --cached HEAD^' ' test_expect_success 'git diff-index --cached HEAD^' '
echo text >>b && echo text >>b &&
echo 3 >c && echo 3 >c &&
git add . && { git add . &&
git diff-index --quiet --cached HEAD^ >cnt test_expect_code 1 git diff-index --quiet --cached HEAD^ >cnt &&
test $? = 1 && test_line_count = 0 cnt test_line_count = 0 cnt
}
' '
test_expect_success 'git diff-tree -Stext HEAD^ HEAD -- b' ' test_expect_success 'git diff-tree -Stext HEAD^ HEAD -- b' '
git commit -m "text in b" && { git commit -m "text in b" &&
git diff-tree --quiet -Stext HEAD^ HEAD -- b >cnt test_expect_code 1 git diff-tree --quiet -Stext HEAD^ HEAD -- b >cnt &&
test $? = 1 && test_line_count = 0 cnt test_line_count = 0 cnt
}
' '
test_expect_success 'git diff-tree -Snot-found HEAD^ HEAD -- b' ' test_expect_success 'git diff-tree -Snot-found HEAD^ HEAD -- b' '
git diff-tree --quiet -Snot-found HEAD^ HEAD -- b >cnt test_expect_code 0 git diff-tree --quiet -Snot-found HEAD^ HEAD -- b >cnt &&
test $? = 0 && test_line_count = 0 cnt test_line_count = 0 cnt
' '
test_expect_success 'git diff-files' ' test_expect_success 'git diff-files' '
echo 3 >>c && { echo 3 >>c &&
git diff-files --quiet >cnt test_expect_code 1 git diff-files --quiet >cnt &&
test $? = 1 && test_line_count = 0 cnt test_line_count = 0 cnt
}
' '
test_expect_success 'git diff-index --cached HEAD' ' test_expect_success 'git diff-index --cached HEAD' '
git update-index c && { git update-index c &&
git diff-index --quiet --cached HEAD >cnt test_expect_code 1 git diff-index --quiet --cached HEAD >cnt &&
test $? = 1 && test_line_count = 0 cnt test_line_count = 0 cnt
}
' '
test_expect_success 'git diff, one file outside repo' ' test_expect_success 'git diff, one file outside repo' '
......
...@@ -528,10 +528,12 @@ test_expect_success 'diff --submodule with objects referenced by alternates' ' ...@@ -528,10 +528,12 @@ test_expect_success 'diff --submodule with objects referenced by alternates' '
sha1_before=$(git rev-parse --short HEAD) sha1_before=$(git rev-parse --short HEAD)
echo b >b && echo b >b &&
git add b && git add b &&
git commit -m b git commit -m b &&
sha1_after=$(git rev-parse --short HEAD) sha1_after=$(git rev-parse --short HEAD) &&
echo "Submodule sub $sha1_before..$sha1_after: {
> b" >../expected echo "Submodule sub $sha1_before..$sha1_after:" &&
echo " > b"
} >../expected
) && ) &&
(cd super && (cd super &&
(cd sub && (cd sub &&
...@@ -539,7 +541,7 @@ test_expect_success 'diff --submodule with objects referenced by alternates' ' ...@@ -539,7 +541,7 @@ test_expect_success 'diff --submodule with objects referenced by alternates' '
git checkout origin/master git checkout origin/master
) && ) &&
git diff --submodule > ../actual git diff --submodule > ../actual
) ) &&
test_cmp expected actual test_cmp expected actual
' '
......
...@@ -8,7 +8,7 @@ test_expect_success setup ' ...@@ -8,7 +8,7 @@ test_expect_success setup '
do do
blob=$(echo $i | git hash-object --stdin) && blob=$(echo $i | git hash-object --stdin) &&
eval "blob$i=$blob" && eval "blob$i=$blob" &&
eval "m$i=\"100644 \$blob$i $i\"" || break eval "m$i=\"100644 \$blob$i $i\"" || return 1
done && done &&
paths= && paths= &&
for b in o x for b in o x
...@@ -24,9 +24,9 @@ test_expect_success setup ' ...@@ -24,9 +24,9 @@ test_expect_success setup '
case "$b" in x) echo "$m1$p" ;; esac && case "$b" in x) echo "$m1$p" ;; esac &&
case "$o" in x) echo "$m2$p" ;; esac && case "$o" in x) echo "$m2$p" ;; esac &&
case "$t" in x) echo "$m3$p" ;; esac || case "$t" in x) echo "$m3$p" ;; esac ||
break return 1
done || break done
done || break done
done >ls-files-s.expect && done >ls-files-s.expect &&
git update-index --index-info <ls-files-s.expect && git update-index --index-info <ls-files-s.expect &&
git ls-files -s >ls-files-s.actual && git ls-files -s >ls-files-s.actual &&
......
...@@ -374,7 +374,7 @@ test_expect_success 'later options override earlier options:' ' ...@@ -374,7 +374,7 @@ test_expect_success 'later options override earlier options:' '
git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M && git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
test_cmp expect_diff_dirstat_M actual_diff_dirstat_M && test_cmp expect_diff_dirstat_M actual_diff_dirstat_M &&
git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC && git diff --dirstat=files,10,cumulative,changes,noncumulative,3 -C -C HEAD^..HEAD >actual_diff_dirstat_CC &&
test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC test_cmp expect_diff_dirstat_CC actual_diff_dirstat_CC &&
git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 HEAD^..HEAD >actual_diff_dirstat && git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 HEAD^..HEAD >actual_diff_dirstat &&
test_cmp expect_diff_dirstat actual_diff_dirstat && test_cmp expect_diff_dirstat actual_diff_dirstat &&
git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 -M HEAD^..HEAD >actual_diff_dirstat_M && git diff --dirstat=files --dirstat=10 --dirstat=cumulative --dirstat=changes --dirstat=noncumulative -X3 -M HEAD^..HEAD >actual_diff_dirstat_M &&
......
...@@ -18,7 +18,7 @@ test_expect_success 'mode-only change show as a 0-line change' ' ...@@ -18,7 +18,7 @@ test_expect_success 'mode-only change show as a 0-line change' '
test_chmod +x b d && test_chmod +x b d &&
echo a >a && echo a >a &&
echo c >c && echo c >c &&
cat >expect <<-\EOF cat >expect <<-\EOF &&
a | 1 + a | 1 +
b | 0 b | 0
... ...
...@@ -33,7 +33,7 @@ test_expect_success 'binary changes do not count in lines' ' ...@@ -33,7 +33,7 @@ test_expect_success 'binary changes do not count in lines' '
echo a >a && echo a >a &&
echo c >c && echo c >c &&
cat "$TEST_DIRECTORY"/test-binary-1.png >d && cat "$TEST_DIRECTORY"/test-binary-1.png >d &&
cat >expect <<-\EOF cat >expect <<-\EOF &&
a | 1 + a | 1 +
c | 1 + c | 1 +
... ...
...@@ -55,7 +55,7 @@ test_expect_success 'exclude unmerged entries from total file count' ' ...@@ -55,7 +55,7 @@ test_expect_success 'exclude unmerged entries from total file count' '
done | done |
git update-index --index-info && git update-index --index-info &&
echo d >d && echo d >d &&
cat >expect <<-\EOF cat >expect <<-\EOF &&
a | 1 + a | 1 +
b | 1 + b | 1 +
... ...
......
...@@ -94,7 +94,7 @@ EOF ...@@ -94,7 +94,7 @@ EOF
while read verb expect cmd args while read verb expect cmd args
do do
test_expect_success "$cmd $verb COLUMNS (big change)" ' test_expect_success "$cmd $verb COLUMNS (big change)" '
COLUMNS=200 git $cmd $args >output COLUMNS=200 git $cmd $args >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp "$expect" actual test_cmp "$expect" actual
' '
...@@ -102,7 +102,7 @@ do ...@@ -102,7 +102,7 @@ do
case "$cmd" in diff|show) continue;; esac case "$cmd" in diff|show) continue;; esac
test_expect_success "$cmd --graph $verb COLUMNS (big change)" ' test_expect_success "$cmd --graph $verb COLUMNS (big change)" '
COLUMNS=200 git $cmd $args --graph >output COLUMNS=200 git $cmd $args --graph >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp "$expect-graph" actual test_cmp "$expect-graph" actual
' '
...@@ -122,7 +122,7 @@ EOF ...@@ -122,7 +122,7 @@ EOF
while read verb expect cmd args while read verb expect cmd args
do do
test_expect_success "$cmd $verb not enough COLUMNS (big change)" ' test_expect_success "$cmd $verb not enough COLUMNS (big change)" '
COLUMNS=40 git $cmd $args >output COLUMNS=40 git $cmd $args >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp "$expect" actual test_cmp "$expect" actual
' '
...@@ -130,7 +130,7 @@ do ...@@ -130,7 +130,7 @@ do
case "$cmd" in diff|show) continue;; esac case "$cmd" in diff|show) continue;; esac
test_expect_success "$cmd --graph $verb not enough COLUMNS (big change)" ' test_expect_success "$cmd --graph $verb not enough COLUMNS (big change)" '
COLUMNS=40 git $cmd $args --graph >output COLUMNS=40 git $cmd $args --graph >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp "$expect-graph" actual test_cmp "$expect-graph" actual
' '
...@@ -150,7 +150,7 @@ EOF ...@@ -150,7 +150,7 @@ EOF
while read verb expect cmd args while read verb expect cmd args
do do
test_expect_success "$cmd $verb statGraphWidth config" ' test_expect_success "$cmd $verb statGraphWidth config" '
git -c diff.statGraphWidth=26 $cmd $args >output git -c diff.statGraphWidth=26 $cmd $args >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp "$expect" actual test_cmp "$expect" actual
' '
...@@ -158,7 +158,7 @@ do ...@@ -158,7 +158,7 @@ do
case "$cmd" in diff|show) continue;; esac case "$cmd" in diff|show) continue;; esac
test_expect_success "$cmd --graph $verb statGraphWidth config" ' test_expect_success "$cmd --graph $verb statGraphWidth config" '
git -c diff.statGraphWidth=26 $cmd $args --graph >output git -c diff.statGraphWidth=26 $cmd $args --graph >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp "$expect-graph" actual test_cmp "$expect-graph" actual
' '
...@@ -179,19 +179,19 @@ EOF ...@@ -179,19 +179,19 @@ EOF
while read cmd args while read cmd args
do do
test_expect_success "$cmd --stat=width with big change" ' test_expect_success "$cmd --stat=width with big change" '
git $cmd $args --stat=40 >output git $cmd $args --stat=40 >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp expect actual test_cmp expect actual
' '
test_expect_success "$cmd --stat-width=width with big change" ' test_expect_success "$cmd --stat-width=width with big change" '
git $cmd $args --stat-width=40 >output git $cmd $args --stat-width=40 >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp expect actual test_cmp expect actual
' '
test_expect_success "$cmd --stat-graph-width with big change" ' test_expect_success "$cmd --stat-graph-width with big change" '
git $cmd $args --stat-graph-width=26 >output git $cmd $args --stat-graph-width=26 >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp expect actual test_cmp expect actual
' '
...@@ -199,13 +199,13 @@ do ...@@ -199,13 +199,13 @@ do
case "$cmd" in diff|show) continue;; esac case "$cmd" in diff|show) continue;; esac
test_expect_success "$cmd --stat-width=width --graph with big change" ' test_expect_success "$cmd --stat-width=width --graph with big change" '
git $cmd $args --stat-width=40 --graph >output git $cmd $args --stat-width=40 --graph >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp expect-graph actual test_cmp expect-graph actual
' '
test_expect_success "$cmd --stat-graph-width --graph with big change" ' test_expect_success "$cmd --stat-graph-width --graph with big change" '
git $cmd $args --stat-graph-width=26 --graph >output git $cmd $args --stat-graph-width=26 --graph >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp expect-graph actual test_cmp expect-graph actual
' '
...@@ -265,7 +265,7 @@ EOF ...@@ -265,7 +265,7 @@ EOF
while read verb expect cmd args while read verb expect cmd args
do do
test_expect_success "$cmd $verb COLUMNS (long filename)" ' test_expect_success "$cmd $verb COLUMNS (long filename)" '
COLUMNS=200 git $cmd $args >output COLUMNS=200 git $cmd $args >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp "$expect" actual test_cmp "$expect" actual
' '
...@@ -273,7 +273,7 @@ do ...@@ -273,7 +273,7 @@ do
case "$cmd" in diff|show) continue;; esac case "$cmd" in diff|show) continue;; esac
test_expect_success "$cmd --graph $verb COLUMNS (long filename)" ' test_expect_success "$cmd --graph $verb COLUMNS (long filename)" '
COLUMNS=200 git $cmd $args --graph >output COLUMNS=200 git $cmd $args --graph >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp "$expect-graph" actual test_cmp "$expect-graph" actual
' '
...@@ -294,7 +294,7 @@ while read verb expect cmd args ...@@ -294,7 +294,7 @@ while read verb expect cmd args
do do
test_expect_success COLUMNS_CAN_BE_1 \ test_expect_success COLUMNS_CAN_BE_1 \
"$cmd $verb prefix greater than COLUMNS (big change)" ' "$cmd $verb prefix greater than COLUMNS (big change)" '
COLUMNS=1 git $cmd $args >output COLUMNS=1 git $cmd $args >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp "$expect" actual test_cmp "$expect" actual
' '
...@@ -303,7 +303,7 @@ do ...@@ -303,7 +303,7 @@ do
test_expect_success COLUMNS_CAN_BE_1 \ test_expect_success COLUMNS_CAN_BE_1 \
"$cmd --graph $verb prefix greater than COLUMNS (big change)" ' "$cmd --graph $verb prefix greater than COLUMNS (big change)" '
COLUMNS=1 git $cmd $args --graph >output COLUMNS=1 git $cmd $args --graph >output &&
grep " | " output >actual && grep " | " output >actual &&
test_cmp "$expect-graph" actual test_cmp "$expect-graph" actual
' '
...@@ -320,7 +320,7 @@ EOF ...@@ -320,7 +320,7 @@ EOF
test_expect_success 'merge --stat respects COLUMNS (big change)' ' test_expect_success 'merge --stat respects COLUMNS (big change)' '
git checkout -b branch HEAD^^ && git checkout -b branch HEAD^^ &&
COLUMNS=100 git merge --stat --no-ff master^ >output && COLUMNS=100 git merge --stat --no-ff master^ >output &&
grep " | " output >actual grep " | " output >actual &&
test_cmp expect actual test_cmp expect actual
' '
...@@ -329,7 +329,7 @@ cat >expect <<'EOF' ...@@ -329,7 +329,7 @@ cat >expect <<'EOF'
EOF EOF
test_expect_success 'merge --stat respects COLUMNS (long filename)' ' test_expect_success 'merge --stat respects COLUMNS (long filename)' '
COLUMNS=100 git merge --stat --no-ff master >output && COLUMNS=100 git merge --stat --no-ff master >output &&
grep " | " output >actual grep " | " output >actual &&
test_cmp expect actual test_cmp expect actual
' '
......
...@@ -17,8 +17,8 @@ test_expect_success 'setup' ' ...@@ -17,8 +17,8 @@ test_expect_success 'setup' '
' '
test_expect_success 'git diff --no-index directories' ' test_expect_success 'git diff --no-index directories' '
git diff --no-index a b >cnt test_expect_code 1 git diff --no-index a b >cnt &&
test $? = 1 && test_line_count = 14 cnt test_line_count = 14 cnt
' '
test_expect_success 'git diff --no-index relative path outside repo' ' test_expect_success 'git diff --no-index relative path outside repo' '
......
...@@ -16,7 +16,7 @@ test_expect_success 'create bogus tree' ' ...@@ -16,7 +16,7 @@ test_expect_success 'create bogus tree' '
test_expect_success 'create tree with matching file' ' test_expect_success 'create tree with matching file' '
echo bar >foo && echo bar >foo &&
git add foo && git add foo &&
good_tree=$(git write-tree) good_tree=$(git write-tree) &&
blob=$(git rev-parse :foo) blob=$(git rev-parse :foo)
' '
......
...@@ -18,7 +18,7 @@ test_expect_success setup ' ...@@ -18,7 +18,7 @@ test_expect_success setup '
cat victim >original && cat victim >original &&
git update-index --add victim && git update-index --add victim &&
: add to the head # add to the head
for i in a b '"$L"' y for i in a b '"$L"' y
do do
echo $i echo $i
...@@ -27,7 +27,7 @@ test_expect_success setup ' ...@@ -27,7 +27,7 @@ test_expect_success setup '
git diff victim >add-a-patch.with && git diff victim >add-a-patch.with &&
git diff --unified=0 >add-a-patch.without && git diff --unified=0 >add-a-patch.without &&
: insert at line two # insert at line two
for i in b a '"$L"' y for i in b a '"$L"' y
do do
echo $i echo $i
...@@ -36,7 +36,7 @@ test_expect_success setup ' ...@@ -36,7 +36,7 @@ test_expect_success setup '
git diff victim >insert-a-patch.with && git diff victim >insert-a-patch.with &&
git diff --unified=0 >insert-a-patch.without && git diff --unified=0 >insert-a-patch.without &&
: modify at the head # modify at the head
for i in a '"$L"' y for i in a '"$L"' y
do do
echo $i echo $i
...@@ -45,16 +45,16 @@ test_expect_success setup ' ...@@ -45,16 +45,16 @@ test_expect_success setup '
git diff victim >mod-a-patch.with && git diff victim >mod-a-patch.with &&
git diff --unified=0 >mod-a-patch.without && git diff --unified=0 >mod-a-patch.without &&
: remove from the head # remove from the head
for i in '"$L"' y for i in '"$L"' y
do do
echo $i echo $i
done >victim && done >victim &&
cat victim >del-a-expect && cat victim >del-a-expect &&
git diff victim >del-a-patch.with git diff victim >del-a-patch.with &&
git diff --unified=0 >del-a-patch.without && git diff --unified=0 >del-a-patch.without &&
: add to the tail # add to the tail
for i in b '"$L"' y z for i in b '"$L"' y z
do do
echo $i echo $i
...@@ -63,7 +63,7 @@ test_expect_success setup ' ...@@ -63,7 +63,7 @@ test_expect_success setup '
git diff victim >add-z-patch.with && git diff victim >add-z-patch.with &&
git diff --unified=0 >add-z-patch.without && git diff --unified=0 >add-z-patch.without &&
: modify at the tail # modify at the tail
for i in b '"$L"' z for i in b '"$L"' z
do do
echo $i echo $i
...@@ -72,16 +72,16 @@ test_expect_success setup ' ...@@ -72,16 +72,16 @@ test_expect_success setup '
git diff victim >mod-z-patch.with && git diff victim >mod-z-patch.with &&
git diff --unified=0 >mod-z-patch.without && git diff --unified=0 >mod-z-patch.without &&
: remove from the tail # remove from the tail
for i in b '"$L"' for i in b '"$L"'
do do
echo $i echo $i
done >victim && done >victim &&
cat victim >del-z-expect && cat victim >del-z-expect &&
git diff victim >del-z-patch.with git diff victim >del-z-patch.with &&
git diff --unified=0 >del-z-patch.without && git diff --unified=0 >del-z-patch.without
: done # done
' '
for with in with without for with in with without
...@@ -95,10 +95,7 @@ do ...@@ -95,10 +95,7 @@ do
test_expect_success "apply $kind-patch $with context" ' test_expect_success "apply $kind-patch $with context" '
cat original >victim && cat original >victim &&
git update-index victim && git update-index victim &&
git apply --index '"$u$kind-patch.$with"' || { git apply --index '"$u$kind-patch.$with"' &&
cat '"$kind-patch.$with"'
(exit 1)
} &&
test_cmp '"$kind"'-expect victim test_cmp '"$kind"'-expect victim
' '
done done
...@@ -113,10 +110,7 @@ do ...@@ -113,10 +110,7 @@ do
test_expect_success "apply non-git $kind-patch without context" ' test_expect_success "apply non-git $kind-patch without context" '
cat original >victim && cat original >victim &&
git update-index victim && git update-index victim &&
git apply --unidiff-zero --index '"$kind-ng.without"' || { git apply --unidiff-zero --index '"$kind-ng.without"' &&
cat '"$kind-ng.without"'
(exit 1)
} &&
test_cmp '"$kind"'-expect victim test_cmp '"$kind"'-expect victim
' '
done done
......
...@@ -56,23 +56,13 @@ test_expect_success 'apply --reject is incompatible with --3way' ' ...@@ -56,23 +56,13 @@ test_expect_success 'apply --reject is incompatible with --3way' '
test_expect_success 'apply without --reject should fail' ' test_expect_success 'apply without --reject should fail' '
if git apply patch.1 test_must_fail git apply patch.1 &&
then
echo "Eh? Why?"
exit 1
fi
test_cmp file1 saved.file1 test_cmp file1 saved.file1
' '
test_expect_success 'apply without --reject should fail' ' test_expect_success 'apply without --reject should fail' '
if git apply --verbose patch.1 test_must_fail git apply --verbose patch.1 &&
then
echo "Eh? Why?"
exit 1
fi
test_cmp file1 saved.file1 test_cmp file1 saved.file1
' '
...@@ -81,21 +71,11 @@ test_expect_success 'apply with --reject should fail but update the file' ' ...@@ -81,21 +71,11 @@ test_expect_success 'apply with --reject should fail but update the file' '
cat saved.file1 >file1 && cat saved.file1 >file1 &&
rm -f file1.rej file2.rej && rm -f file1.rej file2.rej &&
if git apply --reject patch.1 test_must_fail git apply --reject patch.1 &&
then
echo "succeeds with --reject?"
exit 1
fi
test_cmp file1 expected && test_cmp file1 expected &&
cat file1.rej && cat file1.rej &&
test_path_is_missing file2.rej
if test -f file2.rej
then
echo "file2 should not have been touched"
exit 1
fi
' '
test_expect_success 'apply with --reject should fail but update the file' ' test_expect_success 'apply with --reject should fail but update the file' '
...@@ -103,25 +83,12 @@ test_expect_success 'apply with --reject should fail but update the file' ' ...@@ -103,25 +83,12 @@ test_expect_success 'apply with --reject should fail but update the file' '
cat saved.file1 >file1 && cat saved.file1 >file1 &&
rm -f file1.rej file2.rej file2 && rm -f file1.rej file2.rej file2 &&
if git apply --reject patch.2 >rejects test_must_fail git apply --reject patch.2 >rejects &&
then test_path_is_missing file1 &&
echo "succeeds with --reject?"
exit 1
fi
test -f file1 && {
echo "file1 still exists?"
exit 1
}
test_cmp file2 expected && test_cmp file2 expected &&
cat file2.rej && cat file2.rej &&
test_path_is_missing file1.rej
if test -f file1.rej
then
echo "file2 should not have been touched"
exit 1
fi
' '
...@@ -130,25 +97,12 @@ test_expect_success 'the same test with --verbose' ' ...@@ -130,25 +97,12 @@ test_expect_success 'the same test with --verbose' '
cat saved.file1 >file1 && cat saved.file1 >file1 &&
rm -f file1.rej file2.rej file2 && rm -f file1.rej file2.rej file2 &&
if git apply --reject --verbose patch.2 >rejects test_must_fail git apply --reject --verbose patch.2 >rejects &&
then test_path_is_missing file1 &&
echo "succeeds with --reject?"
exit 1
fi
test -f file1 && {
echo "file1 still exists?"
exit 1
}
test_cmp file2 expected && test_cmp file2 expected &&
cat file2.rej && cat file2.rej &&
test_path_is_missing file1.rej
if test -f file1.rej
then
echo "file2 should not have been touched"
exit 1
fi
' '
......
...@@ -99,9 +99,8 @@ test_expect_success 'whitespace=warn, default rule' ' ...@@ -99,9 +99,8 @@ test_expect_success 'whitespace=warn, default rule' '
test_expect_success 'whitespace=error-all, default rule' ' test_expect_success 'whitespace=error-all, default rule' '
apply_patch --whitespace=error-all && return 1 test_must_fail apply_patch --whitespace=error-all &&
test -s target && return 1 ! test -s target
: happy
' '
......
...@@ -20,7 +20,7 @@ test_expect_success setup ' ...@@ -20,7 +20,7 @@ test_expect_success setup '
echo $i >otherfile-$i && echo $i >otherfile-$i &&
git add otherfile-$i && git add otherfile-$i &&
test_tick && test_tick &&
git commit -a -m $i || break git commit -a -m $i || return 1
done && done &&
git format-patch --no-numbered initial && git format-patch --no-numbered initial &&
git checkout -b side initial && git checkout -b side initial &&
......
...@@ -113,11 +113,7 @@ test_expect_success 'diff-filter=M' ' ...@@ -113,11 +113,7 @@ test_expect_success 'diff-filter=M' '
actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) && actual=$(git log --pretty="format:%s" --diff-filter=M HEAD) &&
expect=$(echo second) && expect=$(echo second) &&
test "$actual" = "$expect" || { verbose test "$actual" = "$expect"
echo Oops
echo "Actual: $actual"
false
}
' '
...@@ -125,11 +121,7 @@ test_expect_success 'diff-filter=D' ' ...@@ -125,11 +121,7 @@ test_expect_success 'diff-filter=D' '
actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) && actual=$(git log --pretty="format:%s" --diff-filter=D HEAD) &&
expect=$(echo sixth ; echo third) && expect=$(echo sixth ; echo third) &&
test "$actual" = "$expect" || { verbose test "$actual" = "$expect"
echo Oops
echo "Actual: $actual"
false
}
' '
...@@ -137,11 +129,7 @@ test_expect_success 'diff-filter=R' ' ...@@ -137,11 +129,7 @@ test_expect_success 'diff-filter=R' '
actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) && actual=$(git log -M --pretty="format:%s" --diff-filter=R HEAD) &&
expect=$(echo third) && expect=$(echo third) &&
test "$actual" = "$expect" || { verbose test "$actual" = "$expect"
echo Oops
echo "Actual: $actual"
false
}
' '
...@@ -149,11 +137,7 @@ test_expect_success 'diff-filter=C' ' ...@@ -149,11 +137,7 @@ test_expect_success 'diff-filter=C' '
actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) && actual=$(git log -C -C --pretty="format:%s" --diff-filter=C HEAD) &&
expect=$(echo fourth) && expect=$(echo fourth) &&
test "$actual" = "$expect" || { verbose test "$actual" = "$expect"
echo Oops
echo "Actual: $actual"
false
}
' '
...@@ -161,11 +145,7 @@ test_expect_success 'git log --follow' ' ...@@ -161,11 +145,7 @@ test_expect_success 'git log --follow' '
actual=$(git log --follow --pretty="format:%s" ichi) && actual=$(git log --follow --pretty="format:%s" ichi) &&
expect=$(echo third ; echo second ; echo initial) && expect=$(echo third ; echo second ; echo initial) &&
test "$actual" = "$expect" || { verbose test "$actual" = "$expect"
echo Oops
echo "Actual: $actual"
false
}
' '
...@@ -481,7 +461,7 @@ test_expect_success 'log.decorate configuration' ' ...@@ -481,7 +461,7 @@ test_expect_success 'log.decorate configuration' '
git log --oneline --no-decorate >actual && git log --oneline --no-decorate >actual &&
test_cmp expect.none actual && test_cmp expect.none actual &&
git log --oneline --decorate >actual && git log --oneline --decorate >actual &&
test_cmp expect.short actual test_cmp expect.short actual &&
test_unconfig log.decorate && test_unconfig log.decorate &&
git log --pretty=raw >expect.raw && git log --pretty=raw >expect.raw &&
......
...@@ -61,7 +61,7 @@ test_expect_success 'unparsable dates produce sentinel value' ' ...@@ -61,7 +61,7 @@ test_expect_success 'unparsable dates produce sentinel value' '
test_expect_success 'unparsable dates produce sentinel value (%ad)' ' test_expect_success 'unparsable dates produce sentinel value (%ad)' '
commit=$(munge_author_date HEAD totally_bogus) && commit=$(munge_author_date HEAD totally_bogus) &&
echo >expect && echo >expect &&
git log -1 --format=%ad $commit >actual git log -1 --format=%ad $commit >actual &&
test_cmp expect actual test_cmp expect actual
' '
......
...@@ -66,8 +66,10 @@ test_expect_success UNZIP 'zip archive of empty tree is empty' ' ...@@ -66,8 +66,10 @@ test_expect_success UNZIP 'zip archive of empty tree is empty' '
# handle the empty repo at all, making our later check of its exit code # handle the empty repo at all, making our later check of its exit code
# a no-op). But we cannot do anything reasonable except skip the test # a no-op). But we cannot do anything reasonable except skip the test
# on such platforms anyway, and this is the moral equivalent. # on such platforms anyway, and this is the moral equivalent.
"$GIT_UNZIP" "$TEST_DIRECTORY"/t5004/empty.zip {
expect_code=$? "$GIT_UNZIP" "$TEST_DIRECTORY"/t5004/empty.zip
expect_code=$?
} &&
git archive --format=zip HEAD >empty.zip && git archive --format=zip HEAD >empty.zip &&
make_dir extract && make_dir extract &&
......
...@@ -34,7 +34,7 @@ do ...@@ -34,7 +34,7 @@ do
if test -f "$TEST_DIRECTORY"/t5100/msg$mail--no-inbody-headers if test -f "$TEST_DIRECTORY"/t5100/msg$mail--no-inbody-headers
then then
check_mailinfo $mail --no-inbody-headers check_mailinfo $mail --no-inbody-headers
fi fi &&
if test -f "$TEST_DIRECTORY"/t5100/msg$mail--message-id if test -f "$TEST_DIRECTORY"/t5100/msg$mail--message-id
then then
check_mailinfo $mail --message-id check_mailinfo $mail --message-id
......
...@@ -414,7 +414,7 @@ test_expect_success 'setup tests for the --stdin parameter' ' ...@@ -414,7 +414,7 @@ test_expect_success 'setup tests for the --stdin parameter' '
do do
git tag $head $head git tag $head $head
done && done &&
cat >input <<-\EOF cat >input <<-\EOF &&
refs/heads/C refs/heads/C
refs/heads/A refs/heads/A
refs/heads/D refs/heads/D
......
...@@ -139,8 +139,8 @@ EOF ...@@ -139,8 +139,8 @@ EOF
' '
test_expect_success 'new clone fetch master and tags' ' test_expect_success 'new clone fetch master and tags' '
git branch -D cat test_might_fail git branch -D cat &&
rm -f $U rm -f $U &&
( (
mkdir clone2 && mkdir clone2 &&
cd clone2 && cd clone2 &&
......
...@@ -579,7 +579,7 @@ test_expect_success 'update with arguments' ' ...@@ -579,7 +579,7 @@ test_expect_success 'update with arguments' '
cd one && cd one &&
for b in $(git branch -r) for b in $(git branch -r)
do do
git branch -r -d $b || break git branch -r -d $b || exit 1
done && done &&
git remote add manduca ../mirror && git remote add manduca ../mirror &&
git remote add megaloprepus ../mirror && git remote add megaloprepus ../mirror &&
...@@ -622,7 +622,7 @@ test_expect_success 'update default' ' ...@@ -622,7 +622,7 @@ test_expect_success 'update default' '
cd one && cd one &&
for b in $(git branch -r) for b in $(git branch -r)
do do
git branch -r -d $b || break git branch -r -d $b || exit 1
done && done &&
git config remote.drosophila.skipDefaultUpdate true && git config remote.drosophila.skipDefaultUpdate true &&
git remote update default && git remote update default &&
...@@ -642,7 +642,7 @@ test_expect_success 'update default (overridden, with funny whitespace)' ' ...@@ -642,7 +642,7 @@ test_expect_success 'update default (overridden, with funny whitespace)' '
cd one && cd one &&
for b in $(git branch -r) for b in $(git branch -r)
do do
git branch -r -d $b || break git branch -r -d $b || exit 1
done && done &&
git config remotes.default "$(printf "\t drosophila \n")" && git config remotes.default "$(printf "\t drosophila \n")" &&
git remote update default && git remote update default &&
...@@ -656,7 +656,7 @@ test_expect_success 'update (with remotes.default defined)' ' ...@@ -656,7 +656,7 @@ test_expect_success 'update (with remotes.default defined)' '
cd one && cd one &&
for b in $(git branch -r) for b in $(git branch -r)
do do
git branch -r -d $b || break git branch -r -d $b || exit 1
done && done &&
git config remotes.default "drosophila" && git config remotes.default "drosophila" &&
git remote update && git remote update &&
......
...@@ -124,7 +124,7 @@ test_expect_success 'fetch --prune handles overlapping refspecs' ' ...@@ -124,7 +124,7 @@ test_expect_success 'fetch --prune handles overlapping refspecs' '
git rev-parse origin/master && git rev-parse origin/master &&
git rev-parse origin/pr/42 && git rev-parse origin/pr/42 &&
git config --unset-all remote.origin.fetch git config --unset-all remote.origin.fetch &&
git config remote.origin.fetch refs/pull/*/head:refs/remotes/origin/pr/* && git config remote.origin.fetch refs/pull/*/head:refs/remotes/origin/pr/* &&
git config --add remote.origin.fetch refs/heads/*:refs/remotes/origin/* && git config --add remote.origin.fetch refs/heads/*:refs/remotes/origin/* &&
...@@ -596,7 +596,7 @@ test_configured_prune () { ...@@ -596,7 +596,7 @@ test_configured_prune () {
test_unconfig remote.origin.prune && test_unconfig remote.origin.prune &&
git fetch && git fetch &&
git rev-parse --verify refs/remotes/origin/newbranch git rev-parse --verify refs/remotes/origin/newbranch
) ) &&
# now remove it # now remove it
git branch -d newbranch && git branch -d newbranch &&
......
...@@ -103,8 +103,10 @@ test_expect_success 'confuses pattern as remote when no remote specified' ' ...@@ -103,8 +103,10 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
' '
test_expect_success 'die with non-2 for wrong repository even with --exit-code' ' test_expect_success 'die with non-2 for wrong repository even with --exit-code' '
git ls-remote --exit-code ./no-such-repository ;# not && {
status=$? && git ls-remote --exit-code ./no-such-repository
status=$?
} &&
test $status != 2 && test $status != 0 test $status != 2 && test $status != 0
' '
......
...@@ -120,7 +120,7 @@ test_expect_success 'git fetch --all (skipFetchAll)' ' ...@@ -120,7 +120,7 @@ test_expect_success 'git fetch --all (skipFetchAll)' '
(cd test4 && (cd test4 &&
for b in $(git branch -r) for b in $(git branch -r)
do do
git branch -r -d $b || break git branch -r -d $b || exit 1
done && done &&
git remote add three ../three && git remote add three ../three &&
git config remote.three.skipFetchAll true && git config remote.three.skipFetchAll true &&
...@@ -144,7 +144,7 @@ test_expect_success 'git fetch --multiple (ignoring skipFetchAll)' ' ...@@ -144,7 +144,7 @@ test_expect_success 'git fetch --multiple (ignoring skipFetchAll)' '
(cd test4 && (cd test4 &&
for b in $(git branch -r) for b in $(git branch -r)
do do
git branch -r -d $b || break git branch -r -d $b || exit 1
done && done &&
git fetch --multiple one two three && git fetch --multiple one two three &&
git branch -r > output && git branch -r > output &&
......
...@@ -216,7 +216,7 @@ test_expect_success "Recursion stops when no new submodule commits are fetched" ...@@ -216,7 +216,7 @@ test_expect_success "Recursion stops when no new submodule commits are fetched"
head2=$(git rev-parse --short HEAD) && head2=$(git rev-parse --short HEAD) &&
echo "Fetching submodule submodule" > expect.out.sub && echo "Fetching submodule submodule" > expect.out.sub &&
echo "From $pwd/." > expect.err.sub && echo "From $pwd/." > expect.err.sub &&
echo " $head1..$head2 master -> origin/master" >> expect.err.sub echo " $head1..$head2 master -> origin/master" >>expect.err.sub &&
head -2 expect.err >> expect.err.sub && head -2 expect.err >> expect.err.sub &&
( (
cd downstream && cd downstream &&
...@@ -315,7 +315,7 @@ test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no ne ...@@ -315,7 +315,7 @@ test_expect_success "'--recurse-submodules=on-demand' doesn't recurse when no ne
) && ) &&
head1=$(git rev-parse --short HEAD^) && head1=$(git rev-parse --short HEAD^) &&
git add subdir/deepsubmodule && git add subdir/deepsubmodule &&
git commit -m "new deepsubmodule" git commit -m "new deepsubmodule" &&
head2=$(git rev-parse --short HEAD) && head2=$(git rev-parse --short HEAD) &&
echo "From $pwd/submodule" > ../expect.err.sub && echo "From $pwd/submodule" > ../expect.err.sub &&
echo " $head1..$head2 master -> origin/master" >> ../expect.err.sub echo " $head1..$head2 master -> origin/master" >> ../expect.err.sub
...@@ -337,7 +337,7 @@ test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necess ...@@ -337,7 +337,7 @@ test_expect_success "'--recurse-submodules=on-demand' recurses as deep as necess
head2=$(git rev-parse --short HEAD) && head2=$(git rev-parse --short HEAD) &&
tail -2 expect.err > expect.err.deepsub && tail -2 expect.err > expect.err.deepsub &&
echo "From $pwd/." > expect.err && echo "From $pwd/." > expect.err &&
echo " $head1..$head2 master -> origin/master" >> expect.err echo " $head1..$head2 master -> origin/master" >>expect.err &&
cat expect.err.sub >> expect.err && cat expect.err.sub >> expect.err &&
cat expect.err.deepsub >> expect.err && cat expect.err.deepsub >> expect.err &&
( (
...@@ -387,7 +387,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config ...@@ -387,7 +387,7 @@ test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config
git commit -m "new submodule" && git commit -m "new submodule" &&
head2=$(git rev-parse --short HEAD) && head2=$(git rev-parse --short HEAD) &&
echo "From $pwd/." > expect.err.2 && echo "From $pwd/." > expect.err.2 &&
echo " $head1..$head2 master -> origin/master" >> expect.err.2 echo " $head1..$head2 master -> origin/master" >>expect.err.2 &&
head -2 expect.err >> expect.err.2 && head -2 expect.err >> expect.err.2 &&
( (
cd downstream && cd downstream &&
...@@ -415,7 +415,7 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override ...@@ -415,7 +415,7 @@ test_expect_success "'submodule.<sub>.fetchRecurseSubmodules=on-demand' override
git commit -m "new submodule" && git commit -m "new submodule" &&
head2=$(git rev-parse --short HEAD) && head2=$(git rev-parse --short HEAD) &&
echo "From $pwd/." > expect.err.2 && echo "From $pwd/." > expect.err.2 &&
echo " $head1..$head2 master -> origin/master" >> expect.err.2 echo " $head1..$head2 master -> origin/master" >>expect.err.2 &&
head -2 expect.err >> expect.err.2 && head -2 expect.err >> expect.err.2 &&
( (
cd downstream && cd downstream &&
......
...@@ -104,7 +104,7 @@ test_expect_success 'push fails when commit on multiple branches if one branch h ...@@ -104,7 +104,7 @@ test_expect_success 'push fails when commit on multiple branches if one branch h
' '
test_expect_success 'push succeeds if submodule has no remote and is on the first superproject commit' ' test_expect_success 'push succeeds if submodule has no remote and is on the first superproject commit' '
git init --bare a git init --bare a &&
git clone a a1 && git clone a a1 &&
( (
cd a1 && cd a1 &&
......
...@@ -14,7 +14,7 @@ setup_srcdst_basic () { ...@@ -14,7 +14,7 @@ setup_srcdst_basic () {
} }
test_expect_success setup ' test_expect_success setup '
: create template repository # create template repository
test_commit A && test_commit A &&
test_commit B && test_commit B &&
test_commit C test_commit C
...@@ -159,7 +159,7 @@ test_expect_success 'cover everything with default force-with-lease (protected)' ...@@ -159,7 +159,7 @@ test_expect_success 'cover everything with default force-with-lease (protected)'
( (
cd src && cd src &&
git branch naster master^ git branch naster master^
) ) &&
git ls-remote src refs/heads/\* >expect && git ls-remote src refs/heads/\* >expect &&
( (
cd dst && cd dst &&
...@@ -174,7 +174,7 @@ test_expect_success 'cover everything with default force-with-lease (allowed)' ' ...@@ -174,7 +174,7 @@ test_expect_success 'cover everything with default force-with-lease (allowed)' '
( (
cd src && cd src &&
git branch naster master^ git branch naster master^
) ) &&
( (
cd dst && cd dst &&
git fetch && git fetch &&
......
...@@ -169,7 +169,7 @@ test_expect_failure 'push to password-protected repository (no user in URL)' ' ...@@ -169,7 +169,7 @@ test_expect_failure 'push to password-protected repository (no user in URL)' '
test_commit pw-nouser && test_commit pw-nouser &&
set_askpass user@host pass@host && set_askpass user@host pass@host &&
git push "$HTTPD_URL/auth/dumb/test_repo.git" HEAD && git push "$HTTPD_URL/auth/dumb/test_repo.git" HEAD &&
expect_askpass both user@host expect_askpass both user@host &&
git rev-parse --verify HEAD >expect && git rev-parse --verify HEAD >expect &&
git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git" \ git --git-dir="$HTTPD_DOCUMENT_ROOT_PATH/auth/dumb/test_repo.git" \
rev-parse --verify HEAD >actual && rev-parse --verify HEAD >actual &&
......
...@@ -158,7 +158,7 @@ test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \ ...@@ -158,7 +158,7 @@ test_http_push_nonff "$HTTPD_DOCUMENT_ROOT_PATH"/test_repo.git \
test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' ' test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper' '
# create a dissimilarly-named remote ref so that git is unable to match the # create a dissimilarly-named remote ref so that git is unable to match the
# two refs (viz. local, remote) unless an explicit refspec is provided. # two refs (viz. local, remote) unless an explicit refspec is provided.
git push origin master:retsam git push origin master:retsam &&
echo "change changed" > path2 && echo "change changed" > path2 &&
git commit -a -m path2 --amend && git commit -a -m path2 --amend &&
......
...@@ -15,7 +15,7 @@ test_expect_success 'setup repository' ' ...@@ -15,7 +15,7 @@ test_expect_success 'setup repository' '
git config push.default matching && git config push.default matching &&
echo content1 >file && echo content1 >file &&
git add file && git add file &&
git commit -m one git commit -m one &&
echo content2 >file && echo content2 >file &&
git add file && git add file &&
git commit -m two git commit -m two
...@@ -184,8 +184,8 @@ test_expect_success 'fetch can handle previously-fetched .idx files' ' ...@@ -184,8 +184,8 @@ test_expect_success 'fetch can handle previously-fetched .idx files' '
' '
test_expect_success 'did not use upload-pack service' ' test_expect_success 'did not use upload-pack service' '
grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act test_might_fail grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act &&
: >exp : >exp &&
test_cmp exp act test_cmp exp act
' '
......
...@@ -83,7 +83,7 @@ test_expect_success 'clone http repository' ' ...@@ -83,7 +83,7 @@ test_expect_success 'clone http repository' '
test_expect_success 'fetch changes via http' ' test_expect_success 'fetch changes via http' '
echo content >>file && echo content >>file &&
git commit -a -m two && git commit -a -m two &&
git push public git push public &&
(cd clone && git pull) && (cd clone && git pull) &&
test_cmp file clone/file test_cmp file clone/file
' '
...@@ -169,7 +169,7 @@ test_expect_success 'GIT_SMART_HTTP can disable smart http' ' ...@@ -169,7 +169,7 @@ test_expect_success 'GIT_SMART_HTTP can disable smart http' '
' '
test_expect_success 'invalid Content-Type rejected' ' test_expect_success 'invalid Content-Type rejected' '
test_must_fail git clone $HTTPD_URL/broken_smart/repo.git 2>actual test_must_fail git clone $HTTPD_URL/broken_smart/repo.git 2>actual &&
grep "not valid:" actual grep "not valid:" actual
' '
...@@ -209,7 +209,7 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set ...@@ -209,7 +209,7 @@ test_expect_success 'cookies stored in http.cookiefile when http.savecookies set
git config http.cookiefile cookies.txt && git config http.cookiefile cookies.txt &&
git config http.savecookies true && git config http.savecookies true &&
git ls-remote $HTTPD_URL/smart_cookies/repo.git master && git ls-remote $HTTPD_URL/smart_cookies/repo.git master &&
tail -3 cookies.txt > cookies_tail.txt tail -3 cookies.txt >cookies_tail.txt &&
test_cmp expect_cookies.txt cookies_tail.txt test_cmp expect_cookies.txt cookies_tail.txt
' '
......
...@@ -147,7 +147,7 @@ test_expect_success '--single-branch with detached' ' ...@@ -147,7 +147,7 @@ test_expect_success '--single-branch with detached' '
git for-each-ref refs/remotes/origin | git for-each-ref refs/remotes/origin |
sed -e "/HEAD$/d" \ sed -e "/HEAD$/d" \
-e "s|/remotes/origin/|/heads/|" >../actual -e "s|/remotes/origin/|/heads/|" >../actual
) ) &&
# nothing # nothing
>expect && >expect &&
test_cmp expect actual test_cmp expect actual
......
...@@ -42,7 +42,7 @@ test_expect_success 'rev-list --objects with pathspecs and copied files' ' ...@@ -42,7 +42,7 @@ test_expect_success 'rev-list --objects with pathspecs and copied files' '
test_tick && test_tick &&
git commit -m that && git commit -m that &&
ONE=$(git rev-parse HEAD:one) ONE=$(git rev-parse HEAD:one) &&
git rev-list --objects HEAD two >output && git rev-list --objects HEAD two >output &&
grep "$ONE two/three" output && grep "$ONE two/three" output &&
! grep one output ! grep one output
...@@ -85,7 +85,7 @@ test_expect_success 'rev-list can show index objects' ' ...@@ -85,7 +85,7 @@ test_expect_success 'rev-list can show index objects' '
# - we do not show the root tree; since we updated the index, it # - we do not show the root tree; since we updated the index, it
# does not have a valid cache tree # does not have a valid cache tree
# #
cat >expect <<-\EOF cat >expect <<-\EOF &&
8e4020bb5a8d8c873b25de15933e75cc0fc275df one 8e4020bb5a8d8c873b25de15933e75cc0fc275df one
d9d3a7417b9605cfd88ee6306b28dadc29e6ab08 only-in-index d9d3a7417b9605cfd88ee6306b28dadc29e6ab08 only-in-index
9200b628cf9dc883a85a7abc8d6e6730baee589c two 9200b628cf9dc883a85a7abc8d6e6730baee589c two
......
...@@ -45,7 +45,7 @@ test_expect_success 'setup' ' ...@@ -45,7 +45,7 @@ test_expect_success 'setup' '
head2=$(git rev-parse --verify HEAD) && head2=$(git rev-parse --verify HEAD) &&
head2_short=$(git rev-parse --verify --short $head2) && head2_short=$(git rev-parse --verify --short $head2) &&
tree2=$(git rev-parse --verify HEAD:) && tree2=$(git rev-parse --verify HEAD:) &&
tree2_short=$(git rev-parse --verify --short $tree2) tree2_short=$(git rev-parse --verify --short $tree2) &&
git config --unset i18n.commitEncoding git config --unset i18n.commitEncoding
' '
...@@ -358,10 +358,7 @@ test_expect_success 'empty email' ' ...@@ -358,10 +358,7 @@ test_expect_success 'empty email' '
test_tick && test_tick &&
C=$(GIT_AUTHOR_EMAIL= git commit-tree HEAD^{tree} </dev/null) && C=$(GIT_AUTHOR_EMAIL= git commit-tree HEAD^{tree} </dev/null) &&
A=$(git show --pretty=format:%an,%ae,%ad%n -s $C) && A=$(git show --pretty=format:%an,%ae,%ad%n -s $C) &&
test "$A" = "A U Thor,,Thu Apr 7 15:14:13 2005 -0700" || { verbose test "$A" = "A U Thor,,Thu Apr 7 15:14:13 2005 -0700"
echo "Eh? $A" >failure
false
}
' '
test_expect_success 'del LF before empty (1)' ' test_expect_success 'del LF before empty (1)' '
......
...@@ -95,10 +95,7 @@ check_outcome () { ...@@ -95,10 +95,7 @@ check_outcome () {
git log --pretty="$FMT" --parents $param | git log --pretty="$FMT" --parents $param |
unnote >actual && unnote >actual &&
sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual && sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual &&
test_cmp expect check || { test_cmp expect check
cat actual
false
}
' '
} }
...@@ -121,10 +118,7 @@ test_expect_success 'full history simplification without parent' ' ...@@ -121,10 +118,7 @@ test_expect_success 'full history simplification without parent' '
git log --pretty="$FMT" --full-history E -- lost | git log --pretty="$FMT" --full-history E -- lost |
unnote >actual && unnote >actual &&
sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual && sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual &&
test_cmp expect check || { test_cmp expect check
cat actual
false
}
' '
test_expect_success '--full-diff is not affected by --parents' ' test_expect_success '--full-diff is not affected by --parents' '
......
...@@ -685,7 +685,7 @@ test_expect_success 'setup avoid unnecessary update, dir->(file,nothing)' ' ...@@ -685,7 +685,7 @@ test_expect_success 'setup avoid unnecessary update, dir->(file,nothing)' '
git add -A && git add -A &&
git commit -mA && git commit -mA &&
git checkout -b side git checkout -b side &&
git rm -rf df && git rm -rf df &&
git commit -mB && git commit -mB &&
...@@ -716,7 +716,7 @@ test_expect_success 'setup avoid unnecessary update, modify/delete' ' ...@@ -716,7 +716,7 @@ test_expect_success 'setup avoid unnecessary update, modify/delete' '
git add -A && git add -A &&
git commit -mA && git commit -mA &&
git checkout -b side git checkout -b side &&
git rm -f file && git rm -f file &&
git commit -m "Delete file" && git commit -m "Delete file" &&
...@@ -745,7 +745,7 @@ test_expect_success 'setup avoid unnecessary update, rename/add-dest' ' ...@@ -745,7 +745,7 @@ test_expect_success 'setup avoid unnecessary update, rename/add-dest' '
git add -A && git add -A &&
git commit -mA && git commit -mA &&
git checkout -b side git checkout -b side &&
cp file newfile && cp file newfile &&
git add -A && git add -A &&
git commit -m "Add file copy" && git commit -m "Add file copy" &&
......
...@@ -11,7 +11,7 @@ test_expect_success setup ' ...@@ -11,7 +11,7 @@ test_expect_success setup '
for f in text binary union for f in text binary union
do do
echo Initial >$f && git add $f || break echo Initial >$f && git add $f || return 1
done && done &&
test_tick && test_tick &&
git commit -m Initial && git commit -m Initial &&
...@@ -19,7 +19,7 @@ test_expect_success setup ' ...@@ -19,7 +19,7 @@ test_expect_success setup '
git branch side && git branch side &&
for f in text binary union for f in text binary union
do do
echo Master >>$f && git add $f || break echo Master >>$f && git add $f || return 1
done && done &&
test_tick && test_tick &&
git commit -m Master && git commit -m Master &&
...@@ -27,7 +27,7 @@ test_expect_success setup ' ...@@ -27,7 +27,7 @@ test_expect_success setup '
git checkout side && git checkout side &&
for f in text binary union for f in text binary union
do do
echo Side >>$f && git add $f || break echo Side >>$f && git add $f || return 1
done && done &&
test_tick && test_tick &&
git commit -m Side && git commit -m Side &&
......
...@@ -83,7 +83,7 @@ test_expect_success 'merge fast-forward octopus' ' ...@@ -83,7 +83,7 @@ test_expect_success 'merge fast-forward octopus' '
git reset --hard c0 && git reset --hard c0 &&
test_tick && test_tick &&
git merge c1 c2 git merge c1 c2 &&
expect=$(git rev-parse c2) && expect=$(git rev-parse c2) &&
current=$(git rev-parse HEAD) && current=$(git rev-parse HEAD) &&
test "$expect" = "$current" test "$expect" = "$current"
......
...@@ -52,15 +52,8 @@ test_expect_success 'bisect starts with only one bad' ' ...@@ -52,15 +52,8 @@ test_expect_success 'bisect starts with only one bad' '
test_expect_success 'bisect does not start with only one good' ' test_expect_success 'bisect does not start with only one good' '
git bisect reset && git bisect reset &&
git bisect start && git bisect start &&
git bisect good $HASH1 || return 1 git bisect good $HASH1 &&
test_must_fail git bisect next
if git bisect next
then
echo Oops, should have failed.
false
else
:
fi
' '
test_expect_success 'bisect start with one bad and good' ' test_expect_success 'bisect start with one bad and good' '
...@@ -191,34 +184,27 @@ test_expect_success 'bisect start: no ".git/BISECT_START" if checkout error' ' ...@@ -191,34 +184,27 @@ test_expect_success 'bisect start: no ".git/BISECT_START" if checkout error' '
# but $HASH2 is bad, # but $HASH2 is bad,
# so we should find $HASH2 as the first bad commit # so we should find $HASH2 as the first bad commit
test_expect_success 'bisect skip: successful result' ' test_expect_success 'bisect skip: successful result' '
test_when_finished git bisect reset &&
git bisect reset && git bisect reset &&
git bisect start $HASH4 $HASH1 && git bisect start $HASH4 $HASH1 &&
git bisect skip && git bisect skip &&
git bisect bad > my_bisect_log.txt && git bisect bad > my_bisect_log.txt &&
grep "$HASH2 is the first bad commit" my_bisect_log.txt && grep "$HASH2 is the first bad commit" my_bisect_log.txt
git bisect reset
' '
# $HASH1 is good, $HASH4 is bad, we skip $HASH3 and $HASH2 # $HASH1 is good, $HASH4 is bad, we skip $HASH3 and $HASH2
# so we should not be able to tell the first bad commit # so we should not be able to tell the first bad commit
# among $HASH2, $HASH3 and $HASH4 # among $HASH2, $HASH3 and $HASH4
test_expect_success 'bisect skip: cannot tell between 3 commits' ' test_expect_success 'bisect skip: cannot tell between 3 commits' '
test_when_finished git bisect reset &&
git bisect start $HASH4 $HASH1 && git bisect start $HASH4 $HASH1 &&
git bisect skip || return 1 git bisect skip &&
test_expect_code 2 git bisect skip >my_bisect_log.txt &&
if git bisect skip > my_bisect_log.txt grep "first bad commit could be any of" my_bisect_log.txt &&
then ! grep $HASH1 my_bisect_log.txt &&
echo Oops, should have failed. grep $HASH2 my_bisect_log.txt &&
false grep $HASH3 my_bisect_log.txt &&
else grep $HASH4 my_bisect_log.txt
test $? -eq 2 &&
grep "first bad commit could be any of" my_bisect_log.txt &&
! grep $HASH1 my_bisect_log.txt &&
grep $HASH2 my_bisect_log.txt &&
grep $HASH3 my_bisect_log.txt &&
grep $HASH4 my_bisect_log.txt &&
git bisect reset
fi
' '
# $HASH1 is good, $HASH4 is bad, we skip $HASH3 # $HASH1 is good, $HASH4 is bad, we skip $HASH3
...@@ -226,22 +212,15 @@ test_expect_success 'bisect skip: cannot tell between 3 commits' ' ...@@ -226,22 +212,15 @@ test_expect_success 'bisect skip: cannot tell between 3 commits' '
# so we should not be able to tell the first bad commit # so we should not be able to tell the first bad commit
# among $HASH3 and $HASH4 # among $HASH3 and $HASH4
test_expect_success 'bisect skip: cannot tell between 2 commits' ' test_expect_success 'bisect skip: cannot tell between 2 commits' '
test_when_finished git bisect reset &&
git bisect start $HASH4 $HASH1 && git bisect start $HASH4 $HASH1 &&
git bisect skip || return 1 git bisect skip &&
test_expect_code 2 git bisect good >my_bisect_log.txt &&
if git bisect good > my_bisect_log.txt grep "first bad commit could be any of" my_bisect_log.txt &&
then ! grep $HASH1 my_bisect_log.txt &&
echo Oops, should have failed. ! grep $HASH2 my_bisect_log.txt &&
false grep $HASH3 my_bisect_log.txt &&
else grep $HASH4 my_bisect_log.txt
test $? -eq 2 &&
grep "first bad commit could be any of" my_bisect_log.txt &&
! grep $HASH1 my_bisect_log.txt &&
! grep $HASH2 my_bisect_log.txt &&
grep $HASH3 my_bisect_log.txt &&
grep $HASH4 my_bisect_log.txt &&
git bisect reset
fi
' '
# $HASH1 is good, $HASH4 is both skipped and bad, we skip $HASH3 # $HASH1 is good, $HASH4 is both skipped and bad, we skip $HASH3
...@@ -249,24 +228,18 @@ test_expect_success 'bisect skip: cannot tell between 2 commits' ' ...@@ -249,24 +228,18 @@ test_expect_success 'bisect skip: cannot tell between 2 commits' '
# so we should not be able to tell the first bad commit # so we should not be able to tell the first bad commit
# among $HASH3 and $HASH4 # among $HASH3 and $HASH4
test_expect_success 'bisect skip: with commit both bad and skipped' ' test_expect_success 'bisect skip: with commit both bad and skipped' '
test_when_finished git bisect reset &&
git bisect start && git bisect start &&
git bisect skip && git bisect skip &&
git bisect bad && git bisect bad &&
git bisect good $HASH1 && git bisect good $HASH1 &&
git bisect skip && git bisect skip &&
if git bisect good > my_bisect_log.txt test_expect_code 2 git bisect good >my_bisect_log.txt &&
then grep "first bad commit could be any of" my_bisect_log.txt &&
echo Oops, should have failed. ! grep $HASH1 my_bisect_log.txt &&
false ! grep $HASH2 my_bisect_log.txt &&
else grep $HASH3 my_bisect_log.txt &&
test $? -eq 2 && grep $HASH4 my_bisect_log.txt
grep "first bad commit could be any of" my_bisect_log.txt &&
! grep $HASH1 my_bisect_log.txt &&
! grep $HASH2 my_bisect_log.txt &&
grep $HASH3 my_bisect_log.txt &&
grep $HASH4 my_bisect_log.txt &&
git bisect reset
fi
' '
# We want to automatically find the commit that # We want to automatically find the commit that
...@@ -601,8 +574,7 @@ test_expect_success 'test bisection on bare repo - --no-checkout specified' ' ...@@ -601,8 +574,7 @@ test_expect_success 'test bisection on bare repo - --no-checkout specified' '
git bisect bad $HASH4 && git bisect bad $HASH4 &&
git bisect run eval \ git bisect run eval \
"test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \ "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
>../nocheckout.log && >../nocheckout.log
git bisect reset
) && ) &&
grep "$HASH3 is the first bad commit" nocheckout.log grep "$HASH3 is the first bad commit" nocheckout.log
' '
...@@ -617,8 +589,7 @@ test_expect_success 'test bisection on bare repo - --no-checkout defaulted' ' ...@@ -617,8 +589,7 @@ test_expect_success 'test bisection on bare repo - --no-checkout defaulted' '
git bisect bad $HASH4 && git bisect bad $HASH4 &&
git bisect run eval \ git bisect run eval \
"test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \ "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \
>../defaulted.log && >../defaulted.log
git bisect reset
) && ) &&
grep "$HASH3 is the first bad commit" defaulted.log grep "$HASH3 is the first bad commit" defaulted.log
' '
...@@ -642,14 +613,14 @@ test_expect_success 'broken branch creation' ' ...@@ -642,14 +613,14 @@ test_expect_success 'broken branch creation' '
mkdir missing && mkdir missing &&
:> missing/MISSING && :> missing/MISSING &&
git add missing/MISSING && git add missing/MISSING &&
git commit -m "6(broken): Added file that will be deleted" git commit -m "6(broken): Added file that will be deleted" &&
git tag BROKEN_HASH6 && git tag BROKEN_HASH6 &&
add_line_into_file "7(broken): second line on a broken branch" hello2 && add_line_into_file "7(broken): second line on a broken branch" hello2 &&
git tag BROKEN_HASH7 && git tag BROKEN_HASH7 &&
add_line_into_file "8(broken): third line on a broken branch" hello2 && add_line_into_file "8(broken): third line on a broken branch" hello2 &&
git tag BROKEN_HASH8 && git tag BROKEN_HASH8 &&
git rm missing/MISSING && git rm missing/MISSING &&
git commit -m "9(broken): Remove missing file" git commit -m "9(broken): Remove missing file" &&
git tag BROKEN_HASH9 && git tag BROKEN_HASH9 &&
rm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d rm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d
' '
......
...@@ -28,10 +28,10 @@ make_text() { ...@@ -28,10 +28,10 @@ make_text() {
test_rename() { test_rename() {
test_expect_success "rename ($1, $2)" ' test_expect_success "rename ($1, $2)" '
n='$1' n='$1' &&
expect='$2' expect='$2' &&
git checkout -f master && git checkout -f master &&
git branch -D test$n || true && test_might_fail git branch -D test$n &&
git reset --hard initial && git reset --hard initial &&
for i in $(count $n); do for i in $(count $n); do
make_text $i initial initial >$i make_text $i initial initial >$i
......
...@@ -73,33 +73,12 @@ test_expect_success 'merge white into red (A->B,M->N)' \ ...@@ -73,33 +73,12 @@ test_expect_success 'merge white into red (A->B,M->N)' \
' '
git checkout -b red-white red && git checkout -b red-white red &&
git merge white && git merge white &&
git write-tree >/dev/null || { git write-tree &&
echo "BAD: merge did not complete" test_path_is_file B &&
return 1 test_path_is_file N &&
} test_path_is_file R &&
test_path_is_missing A &&
test -f B || { test_path_is_missing M
echo "BAD: B does not exist in working directory"
return 1
}
test -f N || {
echo "BAD: N does not exist in working directory"
return 1
}
test -f R || {
echo "BAD: R does not exist in working directory"
return 1
}
test -f A && {
echo "BAD: A still exists in working directory"
return 1
}
test -f M && {
echo "BAD: M still exists in working directory"
return 1
}
return 0
' '
# This test broke in 8371234ecaaf6e14fe3f2082a855eff1bbd79ae9 # This test broke in 8371234ecaaf6e14fe3f2082a855eff1bbd79ae9
...@@ -108,32 +87,13 @@ test_expect_success 'merge blue into white (A->B, mod A, A untracked)' \ ...@@ -108,32 +87,13 @@ test_expect_success 'merge blue into white (A->B, mod A, A untracked)' \
git checkout -b white-blue white && git checkout -b white-blue white &&
echo dirty >A && echo dirty >A &&
git merge blue && git merge blue &&
git write-tree >/dev/null || { git write-tree &&
echo "BAD: merge did not complete" test_path_is_file A &&
return 1 echo dirty >expect &&
} test_cmp expect A &&
test_path_is_file B &&
test -f A || { test_path_is_file N &&
echo "BAD: A does not exist in working directory" test_path_is_missing M
return 1
}
test `cat A` = dirty || {
echo "BAD: A content is wrong"
return 1
}
test -f B || {
echo "BAD: B does not exist in working directory"
return 1
}
test -f N || {
echo "BAD: N does not exist in working directory"
return 1
}
test -f M && {
echo "BAD: M still exists in working directory"
return 1
}
return 0
' '
test_done test_done
...@@ -86,7 +86,7 @@ test_expect_success 'setup criss-cross + rename merges with basic modification' ...@@ -86,7 +86,7 @@ test_expect_success 'setup criss-cross + rename merges with basic modification'
rm -rf .git && rm -rf .git &&
git init && git init &&
ten="0 1 2 3 4 5 6 7 8 9" ten="0 1 2 3 4 5 6 7 8 9" &&
for i in $ten for i in $ten
do do
echo line $i in a sample file echo line $i in a sample file
...@@ -195,12 +195,7 @@ test_expect_success 'git detects differently handled merges conflict' ' ...@@ -195,12 +195,7 @@ test_expect_success 'git detects differently handled merges conflict' '
git reset --hard && git reset --hard &&
git checkout D^0 && git checkout D^0 &&
git merge -s recursive E^0 && { test_must_fail git merge -s recursive E^0 &&
echo "BAD: should have conflicted"
test "Incorrectly merged content" = "$(cat new_a)" &&
echo "BAD: Silently accepted wrong content"
return 1
}
test 3 = $(git ls-files -s | wc -l) && test 3 = $(git ls-files -s | wc -l) &&
test 3 = $(git ls-files -u | wc -l) && test 3 = $(git ls-files -u | wc -l) &&
...@@ -533,7 +528,7 @@ test_expect_success 'merge of E2 & D fails but has appropriate contents' ' ...@@ -533,7 +528,7 @@ test_expect_success 'merge of E2 & D fails but has appropriate contents' '
test $(git rev-parse :3:a) = $(git rev-parse B:a) && test $(git rev-parse :3:a) = $(git rev-parse B:a) &&
test $(git rev-parse :2:a/file) = $(git rev-parse E2:a/file) && test $(git rev-parse :2:a/file) = $(git rev-parse E2:a/file) &&
test $(git rev-parse :1:a/file) = $(git rev-parse C:a/file) test $(git rev-parse :1:a/file) = $(git rev-parse C:a/file) &&
test $(git rev-parse :0:ignore-me) = $(git rev-parse A:ignore-me) && test $(git rev-parse :0:ignore-me) = $(git rev-parse A:ignore-me) &&
test -f a~D^0 test -f a~D^0
......
...@@ -15,7 +15,7 @@ test_expect_success 'merge with case-changing rename' ' ...@@ -15,7 +15,7 @@ test_expect_success 'merge with case-changing rename' '
>TestCase && >TestCase &&
git add TestCase && git add TestCase &&
git commit -m "add TestCase" && git commit -m "add TestCase" &&
git tag baseline git tag baseline &&
git checkout -b with-camel && git checkout -b with-camel &&
>foo && >foo &&
git add foo && git add foo &&
......
...@@ -12,10 +12,9 @@ advance () { ...@@ -12,10 +12,9 @@ advance () {
} }
test_expect_success setup ' test_expect_success setup '
for i in a b c; advance a &&
do advance b &&
advance $i || break advance c &&
done &&
git clone . test && git clone . test &&
( (
cd test && cd test &&
......
...@@ -58,7 +58,7 @@ test_expect_success setup ' ...@@ -58,7 +58,7 @@ test_expect_success setup '
git checkout master && git checkout master &&
test_tick && git merge --no-ff fiddler-branch && test_tick && git merge --no-ff fiddler-branch &&
note K note K &&
test_commit "file=Part 1" file "Part 1" L && test_commit "file=Part 1" file "Part 1" L &&
...@@ -92,10 +92,7 @@ check_outcome () { ...@@ -92,10 +92,7 @@ check_outcome () {
git log --format="$FMT" $param | git log --format="$FMT" $param |
unnote >actual && unnote >actual &&
sed -e "$munge_actual" <actual >check && sed -e "$munge_actual" <actual >check &&
test_cmp expect check || { test_cmp expect check
cat actual
false
}
' '
} }
......
...@@ -30,7 +30,7 @@ test_expect_success 'exclude only should error out' ' ...@@ -30,7 +30,7 @@ test_expect_success 'exclude only should error out' '
' '
test_expect_success 't_e_i() exclude sub' ' test_expect_success 't_e_i() exclude sub' '
git log --oneline --format=%s -- . ":(exclude)sub" >actual git log --oneline --format=%s -- . ":(exclude)sub" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
sub2/file sub2/file
file file
...@@ -39,7 +39,7 @@ EOF ...@@ -39,7 +39,7 @@ EOF
' '
test_expect_success 't_e_i() exclude sub/sub/file' ' test_expect_success 't_e_i() exclude sub/sub/file' '
git log --oneline --format=%s -- . ":(exclude)sub/sub/file" >actual git log --oneline --format=%s -- . ":(exclude)sub/sub/file" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
sub2/file sub2/file
sub/sub/sub/file sub/sub/sub/file
...@@ -51,7 +51,7 @@ EOF ...@@ -51,7 +51,7 @@ EOF
' '
test_expect_success 't_e_i() exclude sub using mnemonic' ' test_expect_success 't_e_i() exclude sub using mnemonic' '
git log --oneline --format=%s -- . ":!sub" >actual git log --oneline --format=%s -- . ":!sub" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
sub2/file sub2/file
file file
...@@ -60,7 +60,7 @@ EOF ...@@ -60,7 +60,7 @@ EOF
' '
test_expect_success 't_e_i() exclude :(icase)SUB' ' test_expect_success 't_e_i() exclude :(icase)SUB' '
git log --oneline --format=%s -- . ":(exclude,icase)SUB" >actual git log --oneline --format=%s -- . ":(exclude,icase)SUB" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
sub2/file sub2/file
file file
...@@ -71,7 +71,7 @@ EOF ...@@ -71,7 +71,7 @@ EOF
test_expect_success 't_e_i() exclude sub2 from sub' ' test_expect_success 't_e_i() exclude sub2 from sub' '
( (
cd sub && cd sub &&
git log --oneline --format=%s -- :/ ":/!sub2" >actual git log --oneline --format=%s -- :/ ":/!sub2" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
sub/sub/sub/file sub/sub/sub/file
sub/file2 sub/file2
...@@ -84,7 +84,7 @@ EOF ...@@ -84,7 +84,7 @@ EOF
' '
test_expect_success 't_e_i() exclude sub/*file' ' test_expect_success 't_e_i() exclude sub/*file' '
git log --oneline --format=%s -- . ":(exclude)sub/*file" >actual git log --oneline --format=%s -- . ":(exclude)sub/*file" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
sub2/file sub2/file
sub/file2 sub/file2
...@@ -94,7 +94,7 @@ EOF ...@@ -94,7 +94,7 @@ EOF
' '
test_expect_success 't_e_i() exclude :(glob)sub/*/file' ' test_expect_success 't_e_i() exclude :(glob)sub/*/file' '
git log --oneline --format=%s -- . ":(exclude,glob)sub/*/file" >actual git log --oneline --format=%s -- . ":(exclude,glob)sub/*/file" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
sub2/file sub2/file
sub/sub/sub/file sub/sub/sub/file
...@@ -106,7 +106,7 @@ EOF ...@@ -106,7 +106,7 @@ EOF
' '
test_expect_success 'm_p_d() exclude sub' ' test_expect_success 'm_p_d() exclude sub' '
git ls-files -- . ":(exclude)sub" >actual git ls-files -- . ":(exclude)sub" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
file file
sub2/file sub2/file
...@@ -115,7 +115,7 @@ EOF ...@@ -115,7 +115,7 @@ EOF
' '
test_expect_success 'm_p_d() exclude sub/sub/file' ' test_expect_success 'm_p_d() exclude sub/sub/file' '
git ls-files -- . ":(exclude)sub/sub/file" >actual git ls-files -- . ":(exclude)sub/sub/file" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
file file
sub/file sub/file
...@@ -127,7 +127,7 @@ EOF ...@@ -127,7 +127,7 @@ EOF
' '
test_expect_success 'm_p_d() exclude sub using mnemonic' ' test_expect_success 'm_p_d() exclude sub using mnemonic' '
git ls-files -- . ":!sub" >actual git ls-files -- . ":!sub" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
file file
sub2/file sub2/file
...@@ -136,7 +136,7 @@ EOF ...@@ -136,7 +136,7 @@ EOF
' '
test_expect_success 'm_p_d() exclude :(icase)SUB' ' test_expect_success 'm_p_d() exclude :(icase)SUB' '
git ls-files -- . ":(exclude,icase)SUB" >actual git ls-files -- . ":(exclude,icase)SUB" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
file file
sub2/file sub2/file
...@@ -147,7 +147,7 @@ EOF ...@@ -147,7 +147,7 @@ EOF
test_expect_success 'm_p_d() exclude sub2 from sub' ' test_expect_success 'm_p_d() exclude sub2 from sub' '
( (
cd sub && cd sub &&
git ls-files -- :/ ":/!sub2" >actual git ls-files -- :/ ":/!sub2" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
../file ../file
file file
...@@ -160,7 +160,7 @@ EOF ...@@ -160,7 +160,7 @@ EOF
' '
test_expect_success 'm_p_d() exclude sub/*file' ' test_expect_success 'm_p_d() exclude sub/*file' '
git ls-files -- . ":(exclude)sub/*file" >actual git ls-files -- . ":(exclude)sub/*file" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
file file
sub/file2 sub/file2
...@@ -170,7 +170,7 @@ EOF ...@@ -170,7 +170,7 @@ EOF
' '
test_expect_success 'm_p_d() exclude :(glob)sub/*/file' ' test_expect_success 'm_p_d() exclude :(glob)sub/*/file' '
git ls-files -- . ":(exclude,glob)sub/*/file" >actual git ls-files -- . ":(exclude,glob)sub/*/file" >actual &&
cat <<EOF >expect && cat <<EOF >expect &&
file file
sub/file sub/file
......
...@@ -194,7 +194,7 @@ test_expect_success '--log=5 with custom comment character' ' ...@@ -194,7 +194,7 @@ test_expect_success '--log=5 with custom comment character' '
' '
test_expect_success 'merge.log=0 disables shortlog' ' test_expect_success 'merge.log=0 disables shortlog' '
echo "Merge branch ${apos}left${apos}" >expected echo "Merge branch ${apos}left${apos}" >expected &&
git -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual && git -c merge.log=0 fmt-merge-msg <.git/FETCH_HEAD >actual &&
test_cmp expected actual test_cmp expected actual
' '
......
...@@ -161,10 +161,7 @@ test_expect_success "Michael Cassar's test case" ' ...@@ -161,10 +161,7 @@ test_expect_success "Michael Cassar's test case" '
git mv papers/unsorted/Thesis.pdf papers/all-papers/moo-blah.pdf && git mv papers/unsorted/Thesis.pdf papers/all-papers/moo-blah.pdf &&
T=`git write-tree` && T=`git write-tree` &&
git ls-tree -r $T | grep partA/outline.txt || { git ls-tree -r $T | verbose grep partA/outline.txt
git ls-tree -r $T
(exit 1)
}
' '
rm -fr papers partA path? rm -fr papers partA path?
......
...@@ -1180,8 +1180,8 @@ test_expect_success 'message in editor has initial comment: first line' ' ...@@ -1180,8 +1180,8 @@ test_expect_success 'message in editor has initial comment: first line' '
test_expect_success \ test_expect_success \
'message in editor has initial comment: remainder' ' 'message in editor has initial comment: remainder' '
# remove commented lines from the remainder -- should be empty # remove commented lines from the remainder -- should be empty
>rest.expect >rest.expect &&
sed -e 1d -e '/^#/d' <actual >rest.actual && sed -e 1d -e "/^#/d" <actual >rest.actual &&
test_cmp rest.expect rest.actual test_cmp rest.expect rest.actual
' '
......
...@@ -396,7 +396,7 @@ test_expect_success TTY 'command-specific pager overrides core.pager' ' ...@@ -396,7 +396,7 @@ test_expect_success TTY 'command-specific pager overrides core.pager' '
sane_unset PAGER GIT_PAGER && sane_unset PAGER GIT_PAGER &&
echo "foo:initial" >expect && echo "foo:initial" >expect &&
>actual && >actual &&
test_config core.pager "exit 1" test_config core.pager "exit 1" &&
test_config pager.log "sed s/^/foo:/ >actual" && test_config pager.log "sed s/^/foo:/ >actual" &&
test_terminal git log --format=%s -1 && test_terminal git log --format=%s -1 &&
test_cmp expect actual test_cmp expect actual
......
...@@ -13,7 +13,7 @@ test_expect_success 'setup: a commit with a bogus null sha1 in the tree' ' ...@@ -13,7 +13,7 @@ test_expect_success 'setup: a commit with a bogus null sha1 in the tree' '
{ {
git ls-tree HEAD && git ls-tree HEAD &&
printf "160000 commit $_z40\\tbroken\\n" printf "160000 commit $_z40\\tbroken\\n"
} >broken-tree } >broken-tree &&
echo "add broken entry" >msg && echo "add broken entry" >msg &&
tree=$(git mktree <broken-tree) && tree=$(git mktree <broken-tree) &&
......
...@@ -88,14 +88,10 @@ test_expect_success "checkout with unrelated dirty tree without -m" ' ...@@ -88,14 +88,10 @@ test_expect_success "checkout with unrelated dirty tree without -m" '
git checkout -f master && git checkout -f master &&
fill 0 1 2 3 4 5 6 7 8 >same && fill 0 1 2 3 4 5 6 7 8 >same &&
cp same kept cp same kept &&
git checkout side >messages && git checkout side >messages &&
test_cmp same kept test_cmp same kept &&
(cat > messages.expect <<EOF printf "M\t%s\n" same >messages.expect &&
M same
EOF
) &&
touch messages.expect &&
test_cmp messages.expect messages test_cmp messages.expect messages
' '
...@@ -109,10 +105,7 @@ test_expect_success "checkout -m with dirty tree" ' ...@@ -109,10 +105,7 @@ test_expect_success "checkout -m with dirty tree" '
test "$(git symbolic-ref HEAD)" = "refs/heads/side" && test "$(git symbolic-ref HEAD)" = "refs/heads/side" &&
(cat >expect.messages <<EOF printf "M\t%s\n" one >expect.messages &&
M one
EOF
) &&
test_cmp expect.messages messages && test_cmp expect.messages messages &&
fill "M one" "A three" "D two" >expect.master && fill "M one" "A three" "D two" >expect.master &&
...@@ -409,12 +402,12 @@ test_expect_success \ ...@@ -409,12 +402,12 @@ test_expect_success \
test_expect_success \ test_expect_success \
'checkout w/autosetupmerge=always sets up tracking' ' 'checkout w/autosetupmerge=always sets up tracking' '
test_when_finished git config branch.autosetupmerge false &&
git config branch.autosetupmerge always && git config branch.autosetupmerge always &&
git checkout master && git checkout master &&
git checkout -b track2 && git checkout -b track2 &&
test "$(git config branch.track2.remote)" && test "$(git config branch.track2.remote)" &&
test "$(git config branch.track2.merge)" test "$(git config branch.track2.merge)"'
git config branch.autosetupmerge false'
test_expect_success 'checkout w/--track from non-branch HEAD fails' ' test_expect_success 'checkout w/--track from non-branch HEAD fails' '
git checkout master^0 && git checkout master^0 &&
...@@ -591,7 +584,7 @@ test_expect_success 'checkout --conflict=merge, overriding config' ' ...@@ -591,7 +584,7 @@ test_expect_success 'checkout --conflict=merge, overriding config' '
' '
test_expect_success 'checkout --conflict=diff3' ' test_expect_success 'checkout --conflict=diff3' '
git config --unset merge.conflictstyle test_unconfig merge.conflictstyle &&
setup_conflicting_index && setup_conflicting_index &&
echo "none of the above" >sample && echo "none of the above" >sample &&
echo ourside >expect && echo ourside >expect &&
......
...@@ -119,10 +119,7 @@ test_expect_success C_LOCALE_OUTPUT 'git clean with relative prefix' ' ...@@ -119,10 +119,7 @@ test_expect_success C_LOCALE_OUTPUT 'git clean with relative prefix' '
git clean -n ../src | git clean -n ../src |
sed -n -e "s|^Would remove ||p" sed -n -e "s|^Would remove ||p"
) && ) &&
test "$would_clean" = ../src/part3.c || { verbose test "$would_clean" = ../src/part3.c
echo "OOps <$would_clean>"
false
}
' '
test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' ' test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' '
...@@ -134,10 +131,7 @@ test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' ' ...@@ -134,10 +131,7 @@ test_expect_success C_LOCALE_OUTPUT 'git clean with absolute path' '
git clean -n "$(pwd)/../src" | git clean -n "$(pwd)/../src" |
sed -n -e "s|^Would remove ||p" sed -n -e "s|^Would remove ||p"
) && ) &&
test "$would_clean" = ../src/part3.c || { verbose test "$would_clean" = ../src/part3.c
echo "OOps <$would_clean>"
false
}
' '
test_expect_success 'git clean with out of work tree relative path' ' test_expect_success 'git clean with out of work tree relative path' '
......
...@@ -766,7 +766,7 @@ test_expect_success 'moving the superproject does not break submodules' ' ...@@ -766,7 +766,7 @@ test_expect_success 'moving the superproject does not break submodules' '
( (
cd addtest && cd addtest &&
git submodule status >expect git submodule status >expect
) ) &&
mv addtest addtest2 && mv addtest addtest2 &&
( (
cd addtest2 && cd addtest2 &&
...@@ -987,7 +987,7 @@ test_expect_success 'submodule with UTF-8 name' ' ...@@ -987,7 +987,7 @@ test_expect_success 'submodule with UTF-8 name' '
test_expect_success 'submodule add clone shallow submodule' ' test_expect_success 'submodule add clone shallow submodule' '
mkdir super && mkdir super &&
pwd=$(pwd) pwd=$(pwd) &&
( (
cd super && cd super &&
git init && git init &&
......
...@@ -754,7 +754,7 @@ test_expect_success SYMLINKS 'submodule update can handle symbolic links in pwd' ...@@ -754,7 +754,7 @@ test_expect_success SYMLINKS 'submodule update can handle symbolic links in pwd'
test_expect_success 'submodule update clone shallow submodule' ' test_expect_success 'submodule update clone shallow submodule' '
git clone cloned super3 && git clone cloned super3 &&
pwd=$(pwd) pwd=$(pwd) &&
(cd super3 && (cd super3 &&
sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp && sed -e "s#url = ../#url = file://$pwd/#" <.gitmodules >.gitmodules.tmp &&
mv -f .gitmodules.tmp .gitmodules && mv -f .gitmodules.tmp .gitmodules &&
......
...@@ -431,7 +431,7 @@ test_expect_success 'status -s -uno' ' ...@@ -431,7 +431,7 @@ test_expect_success 'status -s -uno' '
' '
test_expect_success 'status -s (status.showUntrackedFiles no)' ' test_expect_success 'status -s (status.showUntrackedFiles no)' '
git config status.showuntrackedfiles no git config status.showuntrackedfiles no &&
git status -s >output && git status -s >output &&
test_cmp expect output test_cmp expect output
' '
...@@ -465,7 +465,7 @@ EOF ...@@ -465,7 +465,7 @@ EOF
' '
test_expect_success 'status (status.showUntrackedFiles normal)' ' test_expect_success 'status (status.showUntrackedFiles normal)' '
test_config status.showuntrackedfiles normal test_config status.showuntrackedfiles normal &&
git status >output && git status >output &&
test_i18ncmp expect output test_i18ncmp expect output
' '
...@@ -485,7 +485,7 @@ test_expect_success 'status -s -unormal' ' ...@@ -485,7 +485,7 @@ test_expect_success 'status -s -unormal' '
' '
test_expect_success 'status -s (status.showUntrackedFiles normal)' ' test_expect_success 'status -s (status.showUntrackedFiles normal)' '
git config status.showuntrackedfiles normal git config status.showuntrackedfiles normal &&
git status -s >output && git status -s >output &&
test_cmp expect output test_cmp expect output
' '
...@@ -520,7 +520,7 @@ EOF ...@@ -520,7 +520,7 @@ EOF
' '
test_expect_success 'status (status.showUntrackedFiles all)' ' test_expect_success 'status (status.showUntrackedFiles all)' '
test_config status.showuntrackedfiles all test_config status.showuntrackedfiles all &&
git status >output && git status >output &&
test_i18ncmp expect output test_i18ncmp expect output
' '
...@@ -538,7 +538,7 @@ A dir2/added ...@@ -538,7 +538,7 @@ A dir2/added
?? untracked ?? untracked
EOF EOF
test_expect_success 'status -s -uall' ' test_expect_success 'status -s -uall' '
git config --unset status.showuntrackedfiles test_unconfig status.showuntrackedfiles &&
git status -s -uall >output && git status -s -uall >output &&
test_cmp expect output test_cmp expect output
' '
......
...@@ -42,7 +42,7 @@ test_expect_success GPG 'create signed commits' ' ...@@ -42,7 +42,7 @@ test_expect_success GPG 'create signed commits' '
git tag seventh-unsigned && git tag seventh-unsigned &&
test_tick && git rebase -f HEAD^^ && git tag sixth-signed HEAD^ && test_tick && git rebase -f HEAD^^ && git tag sixth-signed HEAD^ &&
git tag seventh-signed git tag seventh-signed &&
echo 8 >file && test_tick && git commit -a -m eighth -SB7227189 && echo 8 >file && test_tick && git commit -a -m eighth -SB7227189 &&
git tag eighth-signed-alt git tag eighth-signed-alt
......
...@@ -133,7 +133,7 @@ test_expect_success 'setup' ' ...@@ -133,7 +133,7 @@ test_expect_success 'setup' '
test_tick && test_tick &&
git commit -m "commit 3" && git commit -m "commit 3" &&
git tag c3 && git tag c3 &&
c3=$(git rev-parse HEAD) c3=$(git rev-parse HEAD) &&
git reset --hard "$c0" && git reset --hard "$c0" &&
create_merge_msgs create_merge_msgs
' '
......
...@@ -29,7 +29,7 @@ test_expect_success GPG 'create signed commits' ' ...@@ -29,7 +29,7 @@ test_expect_success GPG 'create signed commits' '
git checkout -b side-untrusted && git checkout -b side-untrusted &&
echo 3 >baz && git add baz && echo 3 >baz && git add baz &&
test_tick && git commit -SB7227189 -m "untrusted on side" test_tick && git commit -SB7227189 -m "untrusted on side" &&
git checkout master git checkout master
' '
......
...@@ -57,7 +57,7 @@ compare_mtimes () ...@@ -57,7 +57,7 @@ compare_mtimes ()
{ {
read tref rest && read tref rest &&
while read t rest; do while read t rest; do
test "$tref" = "$t" || break test "$tref" = "$t" || return 1
done done
} }
......
...@@ -26,7 +26,7 @@ test_expect_success setup ' ...@@ -26,7 +26,7 @@ test_expect_success setup '
cat one >uno && cat one >uno &&
mv two dos && mv two dos &&
cat one >>tres && cat one >>tres &&
echo DEF >>mouse echo DEF >>mouse &&
git add uno dos tres mouse && git add uno dos tres mouse &&
test_tick && test_tick &&
GIT_AUTHOR_NAME=Second git commit -a -m Second && GIT_AUTHOR_NAME=Second git commit -a -m Second &&
...@@ -153,15 +153,15 @@ test_expect_success 'blame path that used to be a directory' ' ...@@ -153,15 +153,15 @@ test_expect_success 'blame path that used to be a directory' '
' '
test_expect_success 'blame to a commit with no author name' ' test_expect_success 'blame to a commit with no author name' '
TREE=`git rev-parse HEAD:` TREE=`git rev-parse HEAD:` &&
cat >badcommit <<EOF cat >badcommit <<EOF &&
tree $TREE tree $TREE
author <noname> 1234567890 +0000 author <noname> 1234567890 +0000
committer David Reiss <dreiss@facebook.com> 1234567890 +0000 committer David Reiss <dreiss@facebook.com> 1234567890 +0000
some message some message
EOF EOF
COMMIT=`git hash-object -t commit -w badcommit` COMMIT=`git hash-object -t commit -w badcommit` &&
git --no-pager blame $COMMIT -- uno >/dev/null git --no-pager blame $COMMIT -- uno >/dev/null
' '
......
...@@ -5,7 +5,7 @@ test_description='blame output in various formats on a simple case' ...@@ -5,7 +5,7 @@ test_description='blame output in various formats on a simple case'
test_expect_success 'setup' ' test_expect_success 'setup' '
echo a >file && echo a >file &&
git add file git add file &&
test_tick && test_tick &&
git commit -m one && git commit -m one &&
echo b >>file && echo b >>file &&
......
...@@ -818,25 +818,19 @@ test_expect_success $PREREQ '--confirm=compose' ' ...@@ -818,25 +818,19 @@ test_expect_success $PREREQ '--confirm=compose' '
' '
test_expect_success $PREREQ 'confirm by default (due to cc)' ' test_expect_success $PREREQ 'confirm by default (due to cc)' '
CONFIRM=$(git config --get sendemail.confirm) && test_when_finished git config sendemail.confirm never &&
git config --unset sendemail.confirm && git config --unset sendemail.confirm &&
test_confirm test_confirm
ret="$?"
git config sendemail.confirm ${CONFIRM:-never}
test $ret = "0"
' '
test_expect_success $PREREQ 'confirm by default (due to --compose)' ' test_expect_success $PREREQ 'confirm by default (due to --compose)' '
CONFIRM=$(git config --get sendemail.confirm) && test_when_finished git config sendemail.confirm never &&
git config --unset sendemail.confirm && git config --unset sendemail.confirm &&
test_confirm --suppress-cc=all --compose test_confirm --suppress-cc=all --compose
ret="$?"
git config sendemail.confirm ${CONFIRM:-never}
test $ret = "0"
' '
test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' ' test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' '
CONFIRM=$(git config --get sendemail.confirm) && test_when_finished git config sendemail.confirm never &&
git config --unset sendemail.confirm && git config --unset sendemail.confirm &&
rm -fr outdir && rm -fr outdir &&
git format-patch -2 -o outdir && git format-patch -2 -o outdir &&
...@@ -846,13 +840,10 @@ test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' ' ...@@ -846,13 +840,10 @@ test_expect_success $PREREQ 'confirm detects EOF (inform assumes y)' '
--to=nobody@example.com \ --to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \ --smtp-server="$(pwd)/fake.sendmail" \
outdir/*.patch </dev/null outdir/*.patch </dev/null
ret="$?"
git config sendemail.confirm ${CONFIRM:-never}
test $ret = "0"
' '
test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' ' test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' '
CONFIRM=$(git config --get sendemail.confirm) && test_when_finished git config sendemail.confirm never &&
git config sendemail.confirm auto && git config sendemail.confirm auto &&
GIT_SEND_EMAIL_NOTTY=1 && GIT_SEND_EMAIL_NOTTY=1 &&
export GIT_SEND_EMAIL_NOTTY && export GIT_SEND_EMAIL_NOTTY &&
...@@ -861,13 +852,10 @@ test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' ' ...@@ -861,13 +852,10 @@ test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' '
--to=nobody@example.com \ --to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \ --smtp-server="$(pwd)/fake.sendmail" \
$patches </dev/null $patches </dev/null
ret="$?"
git config sendemail.confirm ${CONFIRM:-never}
test $ret = "0"
' '
test_expect_success $PREREQ 'confirm does not loop forever' ' test_expect_success $PREREQ 'confirm does not loop forever' '
CONFIRM=$(git config --get sendemail.confirm) && test_when_finished git config sendemail.confirm never &&
git config sendemail.confirm auto && git config sendemail.confirm auto &&
GIT_SEND_EMAIL_NOTTY=1 && GIT_SEND_EMAIL_NOTTY=1 &&
export GIT_SEND_EMAIL_NOTTY && export GIT_SEND_EMAIL_NOTTY &&
...@@ -876,9 +864,6 @@ test_expect_success $PREREQ 'confirm does not loop forever' ' ...@@ -876,9 +864,6 @@ test_expect_success $PREREQ 'confirm does not loop forever' '
--to=nobody@example.com \ --to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \ --smtp-server="$(pwd)/fake.sendmail" \
$patches $patches
ret="$?"
git config sendemail.confirm ${CONFIRM:-never}
test $ret = "0"
' '
test_expect_success $PREREQ 'utf8 Cc is rfc2047 encoded' ' test_expect_success $PREREQ 'utf8 Cc is rfc2047 encoded' '
...@@ -1325,7 +1310,7 @@ test_expect_success $PREREQ 'sendemail.transferencoding=7bit fails on 8bit data' ...@@ -1325,7 +1310,7 @@ test_expect_success $PREREQ 'sendemail.transferencoding=7bit fails on 8bit data'
test_expect_success $PREREQ '--transfer-encoding overrides sendemail.transferEncoding' ' test_expect_success $PREREQ '--transfer-encoding overrides sendemail.transferEncoding' '
clean_fake_sendmail && clean_fake_sendmail &&
git config sendemail.transferEncoding 8bit git config sendemail.transferEncoding 8bit &&
test_must_fail git send-email \ test_must_fail git send-email \
--transfer-encoding=7bit \ --transfer-encoding=7bit \
--smtp-server="$(pwd)/fake.sendmail" \ --smtp-server="$(pwd)/fake.sendmail" \
......
...@@ -72,16 +72,18 @@ test_expect_success 'follow larger parent' ' ...@@ -72,16 +72,18 @@ test_expect_success 'follow larger parent' '
svn import -m "import a larger parent" import "$svnrepo"/larger-parent && svn import -m "import a larger parent" import "$svnrepo"/larger-parent &&
svn cp -m "hi" "$svnrepo"/larger-parent "$svnrepo"/another-larger && svn cp -m "hi" "$svnrepo"/larger-parent "$svnrepo"/another-larger &&
git svn init --minimize-url -i larger \ git svn init --minimize-url -i larger \
"$svnrepo"/another-larger/trunk/thunk/bump/thud && "$svnrepo"/larger-parent/trunk/thunk/bump/thud &&
git svn fetch -i larger && git svn fetch -i larger &&
git svn init --minimize-url -i larger-parent \
"$svnrepo"/another-larger/trunk/thunk/bump/thud &&
git svn fetch -i larger-parent &&
git rev-parse --verify refs/remotes/larger && git rev-parse --verify refs/remotes/larger &&
git rev-parse --verify \ git rev-parse --verify \
refs/remotes/larger-parent/trunk/thunk/bump/thud && refs/remotes/larger-parent &&
test "`git merge-base \ test "`git merge-base \
refs/remotes/larger-parent/trunk/thunk/bump/thud \ refs/remotes/larger-parent \
refs/remotes/larger`" = \ refs/remotes/larger`" = \
"`git rev-parse refs/remotes/larger`" "`git rev-parse refs/remotes/larger`"
true
' '
test_expect_success 'follow higher-level parent' ' test_expect_success 'follow higher-level parent' '
......
...@@ -34,7 +34,7 @@ test_expect_success 'change svn:mergeinfo' ' ...@@ -34,7 +34,7 @@ test_expect_success 'change svn:mergeinfo' '
' '
test_expect_success 'verify svn:mergeinfo' ' test_expect_success 'verify svn:mergeinfo' '
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/trunk) mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/trunk) &&
test "$mergeinfo" = "/branches/foo:1-10" test "$mergeinfo" = "/branches/foo:1-10"
' '
...@@ -46,7 +46,7 @@ test_expect_success 'change svn:mergeinfo multiline' ' ...@@ -46,7 +46,7 @@ test_expect_success 'change svn:mergeinfo multiline' '
' '
test_expect_success 'verify svn:mergeinfo multiline' ' test_expect_success 'verify svn:mergeinfo multiline' '
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/trunk) mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/trunk) &&
test "$mergeinfo" = "/branches/bar:1-10 test "$mergeinfo" = "/branches/bar:1-10
/branches/other:3-5,8,10-11" /branches/other:3-5,8,10-11"
' '
......
...@@ -24,7 +24,7 @@ test_expect_success 'propagate merge information' ' ...@@ -24,7 +24,7 @@ test_expect_success 'propagate merge information' '
' '
test_expect_success 'check svn:mergeinfo' ' test_expect_success 'check svn:mergeinfo' '
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
test "$mergeinfo" = "/branches/svnb2:3,8" test "$mergeinfo" = "/branches/svnb2:3,8"
' '
...@@ -34,7 +34,7 @@ test_expect_success 'merge another branch' ' ...@@ -34,7 +34,7 @@ test_expect_success 'merge another branch' '
' '
test_expect_success 'check primary parent mergeinfo respected' ' test_expect_success 'check primary parent mergeinfo respected' '
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
test "$mergeinfo" = "/branches/svnb2:3,8 test "$mergeinfo" = "/branches/svnb2:3,8
/branches/svnb3:4,9" /branches/svnb3:4,9"
' '
...@@ -45,7 +45,7 @@ test_expect_success 'merge existing merge' ' ...@@ -45,7 +45,7 @@ test_expect_success 'merge existing merge' '
' '
test_expect_success "check both parents' mergeinfo respected" ' test_expect_success "check both parents' mergeinfo respected" '
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
test "$mergeinfo" = "/branches/svnb2:3,8 test "$mergeinfo" = "/branches/svnb2:3,8
/branches/svnb3:4,9 /branches/svnb3:4,9
/branches/svnb4:5-6,10-12 /branches/svnb4:5-6,10-12
...@@ -70,7 +70,7 @@ test_expect_success 'second forward merge' ' ...@@ -70,7 +70,7 @@ test_expect_success 'second forward merge' '
' '
test_expect_success 'check new mergeinfo added' ' test_expect_success 'check new mergeinfo added' '
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb1) &&
test "$mergeinfo" = "/branches/svnb2:3,8,16-17 test "$mergeinfo" = "/branches/svnb2:3,8,16-17
/branches/svnb3:4,9 /branches/svnb3:4,9
/branches/svnb4:5-6,10-12 /branches/svnb4:5-6,10-12
...@@ -84,7 +84,7 @@ test_expect_success 'reintegration merge' ' ...@@ -84,7 +84,7 @@ test_expect_success 'reintegration merge' '
' '
test_expect_success 'check reintegration mergeinfo' ' test_expect_success 'check reintegration mergeinfo' '
mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb4) mergeinfo=$(svn_cmd propget svn:mergeinfo "$svnrepo"/branches/svnb4) &&
test "$mergeinfo" = "/branches/svnb1:2-4,7-9,13-18 test "$mergeinfo" = "/branches/svnb1:2-4,7-9,13-18
/branches/svnb2:3,8,16-17 /branches/svnb2:3,8,16-17
/branches/svnb3:4,9 /branches/svnb3:4,9
......
...@@ -1132,7 +1132,7 @@ test_expect_success \ ...@@ -1132,7 +1132,7 @@ test_expect_success \
compare_diff_raw expect actual' compare_diff_raw expect actual'
test_expect_success PIPE 'N: read and copy directory' ' test_expect_success PIPE 'N: read and copy directory' '
cat >expect <<-\EOF cat >expect <<-\EOF &&
:100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf :100755 100755 f1fb5da718392694d0076d677d6d0e364c79b0bc f1fb5da718392694d0076d677d6d0e364c79b0bc C100 file2/newf file3/newf
:100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf :100644 100644 7123f7f44e39be127c5eb701e5968176ee9d78b1 7123f7f44e39be127c5eb701e5968176ee9d78b1 C100 file2/oldf file3/oldf
EOF EOF
...@@ -2228,7 +2228,7 @@ test_expect_success 'R: feature import-marks-if-exists' ' ...@@ -2228,7 +2228,7 @@ test_expect_success 'R: feature import-marks-if-exists' '
>expect && >expect &&
git fast-import --import-marks-if-exists=not_io.marks \ git fast-import --import-marks-if-exists=not_io.marks \
--export-marks=io.marks <<-\EOF --export-marks=io.marks <<-\EOF &&
feature import-marks-if-exists=io.marks feature import-marks-if-exists=io.marks
EOF EOF
test_cmp expect io.marks test_cmp expect io.marks
...@@ -2853,8 +2853,8 @@ test_expect_success 'S: notemodify with garbage after mark commit-ish must fail' ...@@ -2853,8 +2853,8 @@ test_expect_success 'S: notemodify with garbage after mark commit-ish must fail'
# from # from
# #
test_expect_success 'S: from with garbage after mark must fail' ' test_expect_success 'S: from with garbage after mark must fail' '
# no && test_must_fail \
git fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err git fast-import --import-marks=marks --export-marks=marks <<-EOF 2>err &&
commit refs/heads/S2 commit refs/heads/S2
mark :303 mark :303
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
...@@ -2865,9 +2865,6 @@ test_expect_success 'S: from with garbage after mark must fail' ' ...@@ -2865,9 +2865,6 @@ test_expect_success 'S: from with garbage after mark must fail' '
M 100644 :403 hello.c M 100644 :403 hello.c
EOF EOF
ret=$? &&
echo returned $ret &&
test $ret -ne 0 && # failed, but it created the commit
# go create the commit, need it for merge test # go create the commit, need it for merge test
git fast-import --import-marks=marks --export-marks=marks <<-EOF && git fast-import --import-marks=marks --export-marks=marks <<-EOF &&
......
...@@ -297,7 +297,7 @@ test_expect_success 'setup incomplete lines' ' ...@@ -297,7 +297,7 @@ test_expect_success 'setup incomplete lines' '
echo "Dominus regit me," >file && echo "Dominus regit me," >file &&
echo "incomplete line" | tr -d "\\012" >>file && echo "incomplete line" | tr -d "\\012" >>file &&
git commit -a -m "Change incomplete line" && git commit -a -m "Change incomplete line" &&
git tag incomplete_lines_chg git tag incomplete_lines_chg &&
echo "Dominus regit me," >file && echo "Dominus regit me," >file &&
git commit -a -m "Remove incomplete line" && git commit -a -m "Remove incomplete line" &&
git tag incomplete_lines_rem git tag incomplete_lines_rem
...@@ -779,7 +779,10 @@ test_expect_success \ ...@@ -779,7 +779,10 @@ test_expect_success \
test_expect_success \ test_expect_success \
'unborn HEAD: "summary" page (with "heads" subview)' \ 'unborn HEAD: "summary" page (with "heads" subview)' \
'git checkout orphan_branch || git checkout --orphan orphan_branch && '{
git checkout orphan_branch ||
git checkout --orphan orphan_branch
} &&
test_when_finished "git checkout master" && test_when_finished "git checkout master" &&
gitweb_run "p=.git;a=summary"' gitweb_run "p=.git;a=summary"'
......
...@@ -145,9 +145,11 @@ test_expect_success 'forks: not skipped unless "forks" feature enabled' ' ...@@ -145,9 +145,11 @@ test_expect_success 'forks: not skipped unless "forks" feature enabled' '
grep -q ">fork of .*<" gitweb.body grep -q ">fork of .*<" gitweb.body
' '
cat >>gitweb_config.perl <<\EOF && test_expect_success 'enable forks feature' '
$feature{'forks'}{'default'} = [1]; cat >>gitweb_config.perl <<-\EOF
EOF $feature{"forks"}{"default"} = [1];
EOF
'
test_expect_success 'forks: forks skipped if "forks" feature enabled' ' test_expect_success 'forks: forks skipped if "forks" feature enabled' '
gitweb_run "a=project_list" && gitweb_run "a=project_list" &&
...@@ -173,7 +175,7 @@ test_expect_success 'forks: can access forked repository' ' ...@@ -173,7 +175,7 @@ test_expect_success 'forks: can access forked repository' '
' '
test_expect_success 'forks: project_index lists all projects (incl. forks)' ' test_expect_success 'forks: project_index lists all projects (incl. forks)' '
cat >expected <<-\EOF cat >expected <<-\EOF &&
.git .git
foo.bar.git foo.bar.git
foo.git foo.git
......
...@@ -568,7 +568,7 @@ test_expect_success 'complete files' ' ...@@ -568,7 +568,7 @@ test_expect_success 'complete files' '
test_completion "git commit " "modified" && test_completion "git commit " "modified" &&
: TODO .gitignore should not be here && : TODO .gitignore should not be here &&
test_completion "git ls-files " <<-\EOF test_completion "git ls-files " <<-\EOF &&
.gitignore .gitignore
dir dir
modified modified
......
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册