* [PATCHv4 00/15] Add missing &&'s in the testsuite @ 2010-09-26 23:14 Elijah Newren 2010-09-26 23:14 ` [PATCHv4 01/15] t3020 (ls-files-error-unmatch): remove stray '1' from end of file Elijah Newren ` (14 more replies) 0 siblings, 15 replies; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren This patch series fixes many of the missing &&s in the testsuite. I'm certain there are still others I have missed. Changes since v3: * Dropped patch 11; Christian has submitted a more thorough fix that includes my patch and more. * Fixed issue in patch 15 of previous series (now patch 14) noted by Ævar. * Fixed subject line for patch 8, as noted by Jeff. * Added acks from Ævar Arnfjörð Bjarmason and Jeff King Elijah Newren (15): t3020 (ls-files-error-unmatch): remove stray '1' from end of file t4017 (diff-retval): replace manual exit code check with test_expect_code t100[12] (read-tree-m-2way, read_tree_m_u_2way): add missing && t4002 (diff-basic): use test_might_fail for commands that might fail t4202 (log): Replace '<git-command> || :' with test_might_fail t3600 (rm): add lots of missing && t4019 (diff-wserror): add lots of missing && t4026 (color): remove unneeded and unchained command t5602 (clone-remote-exec): add missing && t6016 (rev-list-graph-simplify-history): add missing && t7001 (mv): add missing && t7601 (merge-pull-config): add missing && t7800 (difftool): add missing && Add missing &&'s throughout the testsuite Replace "unset VAR" with "unset VAR;" in testsuite as per t/README t/t0001-init.sh | 30 ++++++++-------- t/t0003-attributes.sh | 41 ++++++++++----------- t/t0020-crlf.sh | 2 +- t/t0024-crlf-archive.sh | 4 +- t/t0026-eol-config.sh | 2 +- t/t0050-filesystem.sh | 6 ++-- t/t1000-read-tree-m-3way.sh | 2 +- t/t1001-read-tree-m-2way.sh | 18 +++++----- t/t1002-read-tree-m-u-2way.sh | 10 +++--- t/t1302-repo-version.sh | 2 +- t/t1401-symbolic-ref.sh | 2 +- t/t1402-check-ref-format.sh | 4 +- t/t1410-reflog.sh | 8 ++-- t/t1501-worktree.sh | 2 +- t/t1509-root-worktree.sh | 6 ++-- t/t2007-checkout-symlink.sh | 2 +- t/t2016-checkout-patch.sh | 2 +- t/t2050-git-dir-relative.sh | 4 +- t/t2103-update-index-ignore-missing.sh | 2 +- t/t2200-add-update.sh | 2 +- t/t3001-ls-files-others-exclude.sh | 2 +- t/t3020-ls-files-error-unmatch.sh | 1 - t/t3050-subprojects-fetch.sh | 4 +- t/t3203-branch-output.sh | 6 ++-- t/t3307-notes-man.sh | 2 +- t/t3406-rebase-message.sh | 6 ++-- t/t3408-rebase-multi-line.sh | 2 +- t/t3504-cherry-pick-rerere.sh | 4 +- t/t3600-rm.sh | 38 +++++++++----------- t/t3903-stash.sh | 4 +- t/t3904-stash-patch.sh | 2 +- t/t4002-diff-basic.sh | 12 +++--- t/t4017-diff-retval.sh | 30 +++++---------- t/t4019-diff-wserror.sh | 52 +++++++++++++------------- t/t4021-format-patch-numbered.sh | 2 +- t/t4026-color.sh | 1 - t/t4027-diff-submodule.sh | 2 +- t/t4103-apply-binary.sh | 8 ++-- t/t4104-apply-boundary.sh | 4 +- t/t4111-apply-subdir.sh | 4 +- t/t4119-apply-config.sh | 2 +- t/t4124-apply-ws-rule.sh | 4 +- t/t4127-apply-same-fn.sh | 18 +++++----- t/t4130-apply-criss-cross-rename.sh | 2 +- t/t4133-apply-filenames.sh | 6 ++-- t/t4150-am.sh | 2 +- t/t4202-log.sh | 2 +- t/t5300-pack-object.sh | 4 +- t/t5301-sliding-window.sh | 2 +- t/t5302-pack-index.sh | 2 +- t/t5500-fetch-pack.sh | 2 +- t/t5502-quickfetch.sh | 2 +- t/t5503-tagfollow.sh | 4 +- t/t5510-fetch.sh | 2 +- t/t5516-fetch-push.sh | 20 +++++----- t/t5517-push-mirror.sh | 10 +++--- t/t5519-push-alternates.sh | 2 +- t/t5531-deep-submodule-push.sh | 2 +- t/t5541-http-push.sh | 2 +- t/t5550-http-fetch.sh | 6 ++-- t/t5601-clone.sh | 6 ++-- t/t5602-clone-remote-exec.sh | 14 ++++---- t/t5701-clone-local.sh | 8 ++-- t/t5705-clone-2gb.sh | 2 +- t/t6009-rev-list-parent.sh | 2 +- t/t6010-merge-base.sh | 2 +- t/t6016-rev-list-graph-simplify-history.sh | 24 +++--------- t/t6022-merge-rename.sh | 2 +- t/t6024-recursive-merge.sh | 2 +- t/t6030-bisect-porcelain.sh | 8 ++-- t/t6040-tracking-info.sh | 2 +- t/t7001-mv.sh | 2 +- t/t7004-tag.sh | 14 ++++---- t/t7105-reset-patch.sh | 6 ++-- t/t7300-clean.sh | 6 ++-- t/t7501-commit.sh | 2 +- t/t7502-commit.sh | 6 ++-- t/t7506-status-submodule.sh | 2 +- t/t7600-merge.sh | 2 +- t/t7601-merge-pull-config.sh | 12 +++--- t/t7610-mergetool.sh | 2 +- t/t7700-repack.sh | 2 +- t/t7800-difftool.sh | 11 +++--- t/t8003-blame.sh | 6 ++-- t/t9122-git-svn-author.sh | 4 +- t/t9123-git-svn-rebuild-with-rewriteroot.sh | 2 +- t/t9134-git-svn-ignore-paths.sh | 6 ++-- t/t9137-git-svn-dcommit-clobber-series.sh | 2 +- t/t9138-git-svn-authors-prog.sh | 6 ++-- t/t9146-git-svn-empty-dirs.sh | 6 ++-- t/t9151-svn-mergeinfo.sh | 22 ++++++------ t/t9200-git-cvsexportcommit.sh | 4 +- t/t9401-git-cvsserver-crlf.sh | 2 +- t/t9600-cvsimport.sh | 2 +- 94 files changed, 302 insertions(+), 332 deletions(-) -- 1.7.3.95.g14291 ^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCHv4 01/15] t3020 (ls-files-error-unmatch): remove stray '1' from end of file 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-09-26 23:14 ` [PATCHv4 02/15] t4017 (diff-retval): replace manual exit code check with test_expect_code Elijah Newren ` (13 subsequent siblings) 14 siblings, 0 replies; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t3020-ls-files-error-unmatch.sh | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/t/t3020-ls-files-error-unmatch.sh b/t/t3020-ls-files-error-unmatch.sh index a7d8187..ca01053 100755 --- a/t/t3020-ls-files-error-unmatch.sh +++ b/t/t3020-ls-files-error-unmatch.sh @@ -26,4 +26,3 @@ test_expect_success \ 'git ls-files --error-unmatch foo bar' test_done -1 -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCHv4 02/15] t4017 (diff-retval): replace manual exit code check with test_expect_code 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren 2010-09-26 23:14 ` [PATCHv4 01/15] t3020 (ls-files-error-unmatch): remove stray '1' from end of file Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-09-29 18:07 ` Junio C Hamano 2010-09-26 23:14 ` [PATCHv4 03/15] t100[12] (read-tree-m-2way, read_tree_m_u_2way): add missing && Elijah Newren ` (12 subsequent siblings) 14 siblings, 1 reply; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t4017-diff-retval.sh | 30 ++++++++++-------------------- 1 files changed, 10 insertions(+), 20 deletions(-) diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh index 6158985..6605e12 100755 --- a/t/t4017-diff-retval.sh +++ b/t/t4017-diff-retval.sh @@ -28,37 +28,29 @@ test_expect_success 'git diff --quiet -w HEAD^ HEAD' ' test_must_fail git diff --quiet -w HEAD^ HEAD ' -test_expect_success 'git diff-tree HEAD^ HEAD' ' +test_expect_code 1 'git diff-tree HEAD^ HEAD' ' git diff-tree --exit-code HEAD^ HEAD - test $? = 1 ' -test_expect_success 'git diff-tree HEAD^ HEAD -- a' ' +test_expect_code 0 'git diff-tree HEAD^ HEAD -- a' ' git diff-tree --exit-code HEAD^ HEAD -- a - test $? = 0 ' -test_expect_success 'git diff-tree HEAD^ HEAD -- b' ' +test_expect_code 1 'git diff-tree HEAD^ HEAD -- b' ' git diff-tree --exit-code HEAD^ HEAD -- b - test $? = 1 ' -test_expect_success 'echo HEAD | git diff-tree --stdin' ' +test_expect_code 1 'echo HEAD | git diff-tree --stdin' ' echo $(git rev-parse HEAD) | git diff-tree --exit-code --stdin - test $? = 1 ' -test_expect_success 'git diff-tree HEAD HEAD' ' +test_expect_code 0 'git diff-tree HEAD HEAD' ' git diff-tree --exit-code HEAD HEAD - test $? = 0 ' -test_expect_success 'git diff-files' ' +test_expect_code 0 'git diff-files' ' git diff-files --exit-code - test $? = 0 ' -test_expect_success 'git diff-index --cached HEAD' ' +test_expect_code 0 'git diff-index --cached HEAD' ' git diff-index --exit-code --cached HEAD - test $? = 0 ' -test_expect_success 'git diff-index --cached HEAD^' ' +test_expect_code 1 'git diff-index --cached HEAD^' ' git diff-index --exit-code --cached HEAD^ - test $? = 1 ' test_expect_success 'git diff-index --cached HEAD^' ' echo text >>b && @@ -74,9 +66,8 @@ test_expect_success 'git diff-tree -Stext HEAD^ HEAD -- b' ' test $? = 1 } ' -test_expect_success 'git diff-tree -Snot-found HEAD^ HEAD -- b' ' +test_expect_code 0 'git diff-tree -Snot-found HEAD^ HEAD -- b' ' git diff-tree -p --exit-code -Snot-found HEAD^ HEAD -- b - test $? = 0 ' test_expect_success 'git diff-files' ' echo 3 >>c && { @@ -113,10 +104,9 @@ test_expect_success '--check --exit-code returns 3 for a dirty difference' ' ' -test_expect_success '--check with --no-pager returns 2 for dirty difference' ' +test_expect_code 2 '--check with --no-pager returns 2 for dirty difference' ' git --no-pager diff --check - test $? = 2 ' -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCHv4 02/15] t4017 (diff-retval): replace manual exit code check with test_expect_code 2010-09-26 23:14 ` [PATCHv4 02/15] t4017 (diff-retval): replace manual exit code check with test_expect_code Elijah Newren @ 2010-09-29 18:07 ` Junio C Hamano 2010-09-29 18:45 ` Ævar Arnfjörð Bjarmason 0 siblings, 1 reply; 51+ messages in thread From: Junio C Hamano @ 2010-09-29 18:07 UTC (permalink / raw) To: Elijah Newren; +Cc: git Elijah Newren <newren@gmail.com> writes: > Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> > Signed-off-by: Elijah Newren <newren@gmail.com> > --- > t/t4017-diff-retval.sh | 30 ++++++++++-------------------- > 1 files changed, 10 insertions(+), 20 deletions(-) > > diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh > index 6158985..6605e12 100755 > --- a/t/t4017-diff-retval.sh > +++ b/t/t4017-diff-retval.sh > @@ -28,37 +28,29 @@ test_expect_success 'git diff --quiet -w HEAD^ HEAD' ' > test_must_fail git diff --quiet -w HEAD^ HEAD > ' > > -test_expect_success 'git diff-tree HEAD^ HEAD' ' > +test_expect_code 1 'git diff-tree HEAD^ HEAD' ' > git diff-tree --exit-code HEAD^ HEAD > - test $? = 1 > ' > -test_expect_success 'git diff-tree HEAD^ HEAD -- a' ' > +test_expect_code 0 'git diff-tree HEAD^ HEAD -- a' ' > git diff-tree --exit-code HEAD^ HEAD -- a > - test $? = 0 > ' It probably is better to simply drop "test $? = 0" and keep the expect-success, no? ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 02/15] t4017 (diff-retval): replace manual exit code check with test_expect_code 2010-09-29 18:07 ` Junio C Hamano @ 2010-09-29 18:45 ` Ævar Arnfjörð Bjarmason 2010-10-01 10:23 ` Jonathan Nieder 0 siblings, 1 reply; 51+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2010-09-29 18:45 UTC (permalink / raw) To: Junio C Hamano; +Cc: Elijah Newren, git On Wed, Sep 29, 2010 at 18:07, Junio C Hamano <gitster@pobox.com> wrote: > Elijah Newren <newren@gmail.com> writes: > >> Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> >> Signed-off-by: Elijah Newren <newren@gmail.com> >> --- >> t/t4017-diff-retval.sh | 30 ++++++++++-------------------- >> 1 files changed, 10 insertions(+), 20 deletions(-) >> >> diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh >> index 6158985..6605e12 100755 >> --- a/t/t4017-diff-retval.sh >> +++ b/t/t4017-diff-retval.sh >> @@ -28,37 +28,29 @@ test_expect_success 'git diff --quiet -w HEAD^ HEAD' ' >> test_must_fail git diff --quiet -w HEAD^ HEAD >> ' >> >> -test_expect_success 'git diff-tree HEAD^ HEAD' ' >> +test_expect_code 1 'git diff-tree HEAD^ HEAD' ' >> git diff-tree --exit-code HEAD^ HEAD >> - test $? = 1 >> ' It also looks like this will pass for for all exit codes that *aren't* 1, because if $? != 1 +test_expect_code will get the exit code of 1. But if it's 1 then test $? = 0 will return 0, right? >> -test_expect_success 'git diff-tree HEAD^ HEAD -- a' ' >> +test_expect_code 0 'git diff-tree HEAD^ HEAD -- a' ' >> git diff-tree --exit-code HEAD^ HEAD -- a >> - test $? = 0 >> ' > > It probably is better to simply drop "test $? = 0" and keep the > expect-success, no? Yes. ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 02/15] t4017 (diff-retval): replace manual exit code check with test_expect_code 2010-09-29 18:45 ` Ævar Arnfjörð Bjarmason @ 2010-10-01 10:23 ` Jonathan Nieder 2010-10-01 10:38 ` Ævar Arnfjörð Bjarmason 0 siblings, 1 reply; 51+ messages in thread From: Jonathan Nieder @ 2010-10-01 10:23 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason; +Cc: Junio C Hamano, Elijah Newren, git Ævar Arnfjörð Bjarmason wrote: > On Wed, Sep 29, 2010 at 18:07, Junio C Hamano <gitster@pobox.com> wrote: >> Elijah Newren <newren@gmail.com> writes: >>> -test_expect_success 'git diff-tree HEAD^ HEAD' ' >>> +test_expect_code 1 'git diff-tree HEAD^ HEAD' ' >>> git diff-tree --exit-code HEAD^ HEAD >>> - test $? = 1 >>> ' > > It also looks like this will pass for for all exit codes that *aren't* > 1, because if $? != 1 +test_expect_code will get the exit code of > 1. You probably missed the - indicating that the "test $? = 1" was being removed. But using test_expect_code indeed has a similar problem to the one you point out: it does not nicely discern between outcomes in a test with multiple commands. This shows up in some of the later tests in this script (which is presumably why the original patch did not touch them). Maybe something like this would improve things? -- 8< -- Subject: t4017 (diff-retval): factor out check_exit_status helper When reporting a difference with --exit-code, diff is not only supposed to fail but to fail with status 1. Unfortunately, the shell code to check for that has to amount to git diff --exit-code this that test $? = 1 which breaks &&-chaining if the script author is not cautious. This test script already avoids trouble by putting such code in { } blocks, but that is a bit clunky; better to notice the pattern and give it its own function. While at it, improve the output on failure when debugging with -v by printing the expected and actual exit code (by using test_cmp). The temporary files expect.status and actual.status used to bring this about do not adversely affect the test because those filenames are not tracked, hence not candidates for diffing. Noticed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> --- t/t4017-diff-retval.sh | 93 ++++++++++++++++------------------------------- 1 files changed, 32 insertions(+), 61 deletions(-) diff --git a/t/t4017-diff-retval.sh b/t/t4017-diff-retval.sh index 6158985..51a009b 100755 --- a/t/t4017-diff-retval.sh +++ b/t/t4017-diff-retval.sh @@ -4,6 +4,14 @@ test_description='Return value of diffs' . ./test-lib.sh +check_exit_status () { + echo "$1" >expect.status + shift + "$@" + echo "$?" >actual.status + test_cmp expect.status actual.status +} + test_expect_success 'setup' ' echo "1 " >a && git add . && @@ -21,110 +29,81 @@ test_expect_success 'git diff --quiet -w HEAD^^ HEAD^' ' ' test_expect_success 'git diff --quiet HEAD^^ HEAD^' ' - test_must_fail git diff --quiet HEAD^^ HEAD^ + check_exit_status 1 git diff --quiet HEAD^^ HEAD^ ' test_expect_success 'git diff --quiet -w HEAD^ HEAD' ' - test_must_fail git diff --quiet -w HEAD^ HEAD + check_exit_status 1 git diff --quiet -w HEAD^ HEAD ' test_expect_success 'git diff-tree HEAD^ HEAD' ' - git diff-tree --exit-code HEAD^ HEAD - test $? = 1 + check_exit_status 1 git diff-tree --exit-code HEAD^ HEAD ' test_expect_success 'git diff-tree HEAD^ HEAD -- a' ' git diff-tree --exit-code HEAD^ HEAD -- a - test $? = 0 ' test_expect_success 'git diff-tree HEAD^ HEAD -- b' ' - git diff-tree --exit-code HEAD^ HEAD -- b - test $? = 1 + check_exit_status 1 git diff-tree --exit-code HEAD^ HEAD -- b ' test_expect_success 'echo HEAD | git diff-tree --stdin' ' - echo $(git rev-parse HEAD) | git diff-tree --exit-code --stdin - test $? = 1 + git rev-parse HEAD | + check_exit_status 1 git diff-tree --exit-code --stdin ' test_expect_success 'git diff-tree HEAD HEAD' ' git diff-tree --exit-code HEAD HEAD - test $? = 0 ' test_expect_success 'git diff-files' ' git diff-files --exit-code - test $? = 0 ' test_expect_success 'git diff-index --cached HEAD' ' git diff-index --exit-code --cached HEAD - test $? = 0 ' test_expect_success 'git diff-index --cached HEAD^' ' - git diff-index --exit-code --cached HEAD^ - test $? = 1 + check_exit_status 1 git diff-index --exit-code --cached HEAD^ ' test_expect_success 'git diff-index --cached HEAD^' ' echo text >>b && echo 3 >c && - git add . && { - git diff-index --exit-code --cached HEAD^ - test $? = 1 - } + git add . && + check_exit_status 1 git diff-index --exit-code --cached HEAD^ ' test_expect_success 'git diff-tree -Stext HEAD^ HEAD -- b' ' - git commit -m "text in b" && { - git diff-tree -p --exit-code -Stext HEAD^ HEAD -- b - test $? = 1 - } + git commit -m "text in b" && + check_exit_status 1 git diff-tree -p --exit-code -Stext HEAD^ HEAD -- b ' test_expect_success 'git diff-tree -Snot-found HEAD^ HEAD -- b' ' git diff-tree -p --exit-code -Snot-found HEAD^ HEAD -- b - test $? = 0 ' test_expect_success 'git diff-files' ' - echo 3 >>c && { - git diff-files --exit-code - test $? = 1 - } + echo 3 >>c && + check_exit_status 1 git diff-files --exit-code ' test_expect_success 'git diff-index --cached HEAD' ' - git update-index c && { - git diff-index --exit-code --cached HEAD - test $? = 1 - } + git update-index c && + check_exit_status 1 git diff-index --exit-code --cached HEAD ' test_expect_success '--check --exit-code returns 0 for no difference' ' - git diff --check --exit-code - ' test_expect_success '--check --exit-code returns 1 for a clean difference' ' - - echo "good" > a && - git diff --check --exit-code - test $? = 1 - + echo "good" >a && + check_exit_status 1 git diff --check --exit-code ' test_expect_success '--check --exit-code returns 3 for a dirty difference' ' - echo "bad " >> a && - git diff --check --exit-code - test $? = 3 - + check_exit_status 3 git diff --check --exit-code ' test_expect_success '--check with --no-pager returns 2 for dirty difference' ' - - git --no-pager diff --check - test $? = 2 - + check_exit_status 2 git --no-pager diff --check ' test_expect_success 'check should test not just the last line' ' echo "" >>a && - git --no-pager diff --check - test $? = 2 - + check_exit_status 2 git --no-pager diff --check ' test_expect_success 'check detects leftover conflict markers' ' @@ -133,10 +112,8 @@ test_expect_success 'check detects leftover conflict markers' ' echo binary >>b && git commit -m "side" b && test_must_fail git merge master && - git add b && ( - git --no-pager diff --cached --check >test.out - test $? = 2 - ) && + git add b && + check_exit_status 2 git --no-pager diff --cached --check >test.out && test 3 = $(grep "conflict marker" test.out | wc -l) && git reset --hard ' @@ -146,19 +123,13 @@ test_expect_success 'check honors conflict marker length' ' echo ">>>>>>> boo" >>b && echo "======" >>a && git diff --check a && - ( - git diff --check b - test $? = 2 - ) && + check_exit_status 2 git diff --check b && git reset --hard && echo ">>>>>>>> boo" >>b && echo "========" >>a && git diff --check && echo "b conflict-marker-size=8" >.gitattributes && - ( - git diff --check b - test $? = 2 - ) && + check_exit_status 2 git diff --check b && git diff --check a && git reset --hard ' -- 1.7.2.3 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCHv4 02/15] t4017 (diff-retval): replace manual exit code check with test_expect_code 2010-10-01 10:23 ` Jonathan Nieder @ 2010-10-01 10:38 ` Ævar Arnfjörð Bjarmason 2010-10-01 11:52 ` Jonathan Nieder 2010-10-01 16:20 ` Junio C Hamano 0 siblings, 2 replies; 51+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2010-10-01 10:38 UTC (permalink / raw) To: Jonathan Nieder; +Cc: Junio C Hamano, Elijah Newren, git On Fri, Oct 1, 2010 at 10:23, Jonathan Nieder <jrnieder@gmail.com> wrote: > Ævar Arnfjörð Bjarmason wrote: >> On Wed, Sep 29, 2010 at 18:07, Junio C Hamano <gitster@pobox.com> wrote: >>> Elijah Newren <newren@gmail.com> writes: > >>>> -test_expect_success 'git diff-tree HEAD^ HEAD' ' >>>> +test_expect_code 1 'git diff-tree HEAD^ HEAD' ' >>>> git diff-tree --exit-code HEAD^ HEAD >>>> - test $? = 1 >>>> ' >> >> It also looks like this will pass for for all exit codes that *aren't* >> 1, because if $? != 1 +test_expect_code will get the exit code of >> 1. > > You probably missed the - indicating that the "test $? = 1" was being > removed. Correct. I misread that. > +check_exit_status () { > + echo "$1" >expect.status > + shift > + "$@" > + echo "$?" >actual.status > + test_cmp expect.status actual.status > +} If we add this it should be in the test-lib.sh, it'll probably be useful for other tests. > test_expect_success 'setup' ' > echo "1 " >a && > git add . && > @@ -21,110 +29,81 @@ test_expect_success 'git diff --quiet -w HEAD^^ HEAD^' ' > ' > > test_expect_success 'git diff --quiet HEAD^^ HEAD^' ' > - test_must_fail git diff --quiet HEAD^^ HEAD^ > + check_exit_status 1 git diff --quiet HEAD^^ HEAD^ > ' In most uses of check_exit_status you're using it is the very last command within a test_expect_success. Isn't it redundant to using just "test_expect_code $code ..." there? > test_expect_success 'check detects leftover conflict markers' ' > @@ -133,10 +112,8 @@ test_expect_success 'check detects leftover conflict markers' ' > echo binary >>b && > git commit -m "side" b && > test_must_fail git merge master && > - git add b && ( > - git --no-pager diff --cached --check >test.out > - test $? = 2 > - ) && > + git add b && > + check_exit_status 2 git --no-pager diff --cached --check >test.out && > test 3 = $(grep "conflict marker" test.out | wc -l) && > git reset --hard > ' But of course in cases like these it's needed. In any case, we only use test_expect_code for two tests in the whole test suite now, and checking the exit status for individual commands is more self-documenting and less prone to break if we add more tests to a given test. So IMO the best thing to do would be to re-appropriate "test_expect_code" so that it runs inside a test (i.e. does what your check_exit_status does), and not at the top-level. Then do s/check_exit_status/test_expect_code/g on your patch, and change the tests using test_expect_code in t1504-ceiling-dirs.sh and t6020-merge-df.sh to use test_expect_success + test_expect_code. ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 02/15] t4017 (diff-retval): replace manual exit code check with test_expect_code 2010-10-01 10:38 ` Ævar Arnfjörð Bjarmason @ 2010-10-01 11:52 ` Jonathan Nieder 2010-10-01 16:20 ` Junio C Hamano 1 sibling, 0 replies; 51+ messages in thread From: Jonathan Nieder @ 2010-10-01 11:52 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason; +Cc: Junio C Hamano, Elijah Newren, git Ævar Arnfjörð Bjarmason wrote: > On Fri, Oct 1, 2010 at 10:23, Jonathan Nieder <jrnieder@gmail.com> wrote: >> +check_exit_status () { >> + echo "$1" >expect.status >> + shift >> + "$@" >> + echo "$?" >actual.status >> + test_cmp expect.status actual.status >> +} > > If we add this it should be in the test-lib.sh, it'll probably be > useful for other tests. FWIW a more generally useful function would have to look something like this: test_exit_status () { want_code=$1 shift "$@" exit_code=$? if test $exit_code = $want_code then return 0 else echo >&2 "test_exit_status $want_code: command had status $exit_code: $*" return 1 fi } to avoid touching the file system. > and > change the tests using test_expect_code in t1504-ceiling-dirs.sh and > t6020-merge-df.sh to use test_expect_success + test_expect_code. Not a bad thing to do anyway. ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 02/15] t4017 (diff-retval): replace manual exit code check with test_expect_code 2010-10-01 10:38 ` Ævar Arnfjörð Bjarmason 2010-10-01 11:52 ` Jonathan Nieder @ 2010-10-01 16:20 ` Junio C Hamano 2010-10-01 17:16 ` [PATCH] test-lib: make test_expect_code a test command Ævar Arnfjörð Bjarmason 1 sibling, 1 reply; 51+ messages in thread From: Junio C Hamano @ 2010-10-01 16:20 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason Cc: Jonathan Nieder, Elijah Newren, git Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes: > On Fri, Oct 1, 2010 at 10:23, Jonathan Nieder <jrnieder@gmail.com> wrote: > >> test_expect_success 'git diff --quiet HEAD^^ HEAD^' ' >> - test_must_fail git diff --quiet HEAD^^ HEAD^ >> + check_exit_status 1 git diff --quiet HEAD^^ HEAD^ >> ' > > In most uses of check_exit_status you're using it is the very last > command within a test_expect_success. Isn't it redundant to using just > "test_expect_code $code ..." there? Doesn't test_expect_code 1 'phoney' ' foo && bar && (exit 1) ' incorrectly succeed if "foo" or "bar" happened to fail with exit status 1? > So IMO the best thing to do would be to re-appropriate > "test_expect_code" so that it runs inside a test (i.e. does what your > check_exit_status does), and not at the top-level. I like it. It should have been done the way you suggest from the beginning. It is unfortunate that we didn't think of wrappers like test_must_fail and friends when we originally did test_expect_code, but it is never too late to correct that mistake. ^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH] test-lib: make test_expect_code a test command 2010-10-01 16:20 ` Junio C Hamano @ 2010-10-01 17:16 ` Ævar Arnfjörð Bjarmason 2010-10-01 17:39 ` Sverre Rabbelier ` (2 more replies) 0 siblings, 3 replies; 51+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2010-10-01 17:16 UTC (permalink / raw) To: git Cc: Junio C Hamano, Elijah Newren, Jonathan Nieder, Ævar Arnfjörð Bjarmason Change test_expect_code to be a normal test command instead of a top-level command. As a top-level command it would fail in cases like: test_expect_code 1 'phoney' ' foo && bar && (exit 1) ' Here the test might incorrectly succeed if "foo" or "bar" happened to fail with exit status 1. Instead we now do: test_expect_success 'phoney' ' foo && bar && test_expect_code 1 "(exit 1)" ' Which will only succeed if "foo" and "bar" return status 0, and "(exit 1)" returns status 1. Some test code in t0000-basic.sh relied on the old semantics of test_expect_code to test the test_when_finished command. I've converted that code to use an external test similar no the TODO test I added in v1.7.3-rc0~2^2~3. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- On Fri, Oct 1, 2010 at 16:20, Junio C Hamano <gitster@pobox.com> wrote: > Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes: >> So IMO the best thing to do would be to re-appropriate >> "test_expect_code" so that it runs inside a test (i.e. does what your >> check_exit_status does), and not at the top-level. > > I like it. It should have been done the way you suggest from the > beginning. It is unfortunate that we didn't think of wrappers like > test_must_fail and friends when we originally did test_expect_code, but it > is never too late to correct that mistake. Here's a patch to implement that. It goes on top of master so Elijah Newren's patch presumably will have to be re-done on top of it. t/README | 16 +++++++------ t/t0000-basic.sh | 55 ++++++++++++++++++++++++++++++++++++++-------- t/t1504-ceiling-dirs.sh | 5 ++- t/t6020-merge-df.sh | 4 ++- t/test-lib.sh | 40 ++++++++++++++++++--------------- 5 files changed, 82 insertions(+), 38 deletions(-) diff --git a/t/README b/t/README index a1eb7c8..c216e8c 100644 --- a/t/README +++ b/t/README @@ -395,13 +395,6 @@ library for your script to use. Like test_expect_success this function can optionally use a three argument invocation with a prerequisite as the first argument. - - test_expect_code [<prereq>] <code> <message> <script> - - Analogous to test_expect_success, but pass the test if it exits - with a given exit <code> - - test_expect_code 1 'Merge with d/f conflicts' 'git merge "merge msg" B master' - - test_debug <script> This takes a single argument, <script>, and evaluates it only @@ -482,6 +475,15 @@ library for your script to use. 'Perl API' \ "$PERL_PATH" "$TEST_DIRECTORY"/t9700/test.pl + - test_expect_code <exit-code> <git-command> + + Run a git command and ensure that it exits with the given exit + code. For example: + + test_expect_success 'Merge with d/f conflicts' ' + test_expect_code 1 git merge "merge msg" B master + ' + - test_must_fail <git-command> Run a git command and ensure it fails in a controlled way. Use diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index f688bd3..c2f5f8d 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -130,22 +130,57 @@ test_expect_success 'tests clean up after themselves' ' test_when_finished clean=yes ' -cleaner=no -test_expect_code 1 'tests clean up even after a failure' ' - test_when_finished cleaner=yes && - (exit 1) -' - -if test $clean$cleaner != yesyes +if test $clean != yes then - say "bug in test framework: cleanup commands do not work reliably" + say "bug in test framework: basic cleanup command does not work reliably" exit 1 fi -test_expect_code 2 'failure to clean up causes the test to fail' ' - test_when_finished "(exit 2)" +test_expect_success 'tests clean up even on failures' " + mkdir failing-cleanup && + (cd failing-cleanup && + cat >failing-cleanup.sh <<EOF && +#!$SHELL_PATH + +test_description='Failing tests with cleanup commands' + +# Point to the t/test-lib.sh, which isn't in ../ as usual +TEST_DIRECTORY=\"$TEST_DIRECTORY\" +. \"\$TEST_DIRECTORY\"/test-lib.sh + +test_expect_success 'tests clean up even after a failure' ' + touch clean-after-failure && + test_when_finished rm clean-after-failure && + (exit 1) ' +test_expect_success 'failure to clean up causes the test to fail' ' + test_when_finished \"(exit 2)\" +' + +test_done +EOF + chmod +x failing-cleanup.sh && + test_must_fail ./failing-cleanup.sh >out 2>err && + ! test -s err && + ! test -f \"trash directory.failing-cleanup/clean-after-failure\" && +cat >expect <<EOF && +not ok - 1 tests clean up even after a failure +# +# touch clean-after-failure && +# test_when_finished rm clean-after-failure && +# (exit 1) +# +not ok - 2 failure to clean up causes the test to fail +# +# test_when_finished \"(exit 2)\" +# +# failed 2 among 2 test(s) +1..2 +EOF + test_cmp expect out) +" + ################################################################ # Basics of the basics diff --git a/t/t1504-ceiling-dirs.sh b/t/t1504-ceiling-dirs.sh index df5ad8c..cce87a5 100755 --- a/t/t1504-ceiling-dirs.sh +++ b/t/t1504-ceiling-dirs.sh @@ -9,8 +9,9 @@ test_prefix() { } test_fail() { - test_expect_code 128 "$1: prefix" \ - "git rev-parse --show-prefix" + test_expect_success "$1: prefix" ' + test_expect_code 128 git rev-parse --show-prefix + ' } TRASH_ROOT="$PWD" diff --git a/t/t6020-merge-df.sh b/t/t6020-merge-df.sh index 490d397..5d91d05 100755 --- a/t/t6020-merge-df.sh +++ b/t/t6020-merge-df.sh @@ -20,7 +20,9 @@ echo "file dir" > dir && git add dir && git commit -m "File: dir"' -test_expect_code 1 'Merge with d/f conflicts' 'git merge "merge msg" B master' +test_expect_success 'Merge with d/f conflicts' ' + test_expect_code 1 git merge "merge msg" B master +' test_expect_success 'F/D conflict' ' git reset --hard && diff --git a/t/test-lib.sh b/t/test-lib.sh index 830e5e7..d86edcd 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -473,24 +473,6 @@ test_expect_success () { echo >&3 "" } -test_expect_code () { - test "$#" = 4 && { prereq=$1; shift; } || prereq= - test "$#" = 3 || - error "bug in the test script: not 3 or 4 parameters to test-expect-code" - if ! test_skip "$@" - then - say >&3 "expecting exit code $1: $3" - test_run_ "$3" - if [ "$?" = 0 -a "$eval_ret" = "$1" ] - then - test_ok_ "$2" - else - test_failure_ "$@" - fi - fi - echo >&3 "" -} - # test_external runs external test scripts that provide continuous # test output about their progress, and succeeds/fails on # zero/non-zero exit code. It outputs the test output on stdout even @@ -658,6 +640,28 @@ test_might_fail () { return 0 } +# Similar to test_must_fail and test_might_fail, but check that a +# given command exited with a given exit code. Meant to be used as: +# +# test_expect_success 'Merge with d/f conflicts' ' +# test_expect_code 1 git merge "merge msg" B master +# ' + +test_expect_code () { + want_code=$1 + shift + "$@" + exit_code=$? + if test $exit_code = $want_code + then + echo >&2 "test_expect_code: command exited with $exit_code: $*" + return 0 + else + echo >&2 "test_expect_code: command exited with $exit_code, we wanted $want_code $*" + return 1 + fi +} + # test_cmp is a helper function to compare actual and expected output. # You can use it like: # -- 1.7.3.159.g610493 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH] test-lib: make test_expect_code a test command 2010-10-01 17:16 ` [PATCH] test-lib: make test_expect_code a test command Ævar Arnfjörð Bjarmason @ 2010-10-01 17:39 ` Sverre Rabbelier 2010-10-01 17:46 ` Ævar Arnfjörð Bjarmason 2010-10-01 17:42 ` [PATCH v2] " Ævar Arnfjörð Bjarmason 2010-10-01 18:55 ` [PATCH] " Jonathan Nieder 2 siblings, 1 reply; 51+ messages in thread From: Sverre Rabbelier @ 2010-10-01 17:39 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason Cc: git, Junio C Hamano, Elijah Newren, Jonathan Nieder Heya, On Fri, Oct 1, 2010 at 19:16, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > converted that code to use an external test similar no the TODO test I s/no/to/ > +cat >expect <<EOF && > +not ok - 1 tests clean up even after a failure > +# > +# touch clean-after-failure && > +# test_when_finished rm clean-after-failure && > +# (exit 1) > +# > +not ok - 2 failure to clean up causes the test to fail > +# > +# test_when_finished \"(exit 2)\" > +# > +# failed 2 among 2 test(s) > +1..2 > +EOF > + test_cmp expect out) I still like the putting-the-code-in-a-separate-harness, but I'm wondering if we can't come up with something better than comparing with test output that could change in the future... unless we decide to standardize on TAP and not deviate from it? Either case, wouldn't it at least be a good idea to get rid of the parts after the # in the comparrison? -- Cheers, Sverre Rabbelier ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] test-lib: make test_expect_code a test command 2010-10-01 17:39 ` Sverre Rabbelier @ 2010-10-01 17:46 ` Ævar Arnfjörð Bjarmason 2010-10-01 17:47 ` Sverre Rabbelier 0 siblings, 1 reply; 51+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2010-10-01 17:46 UTC (permalink / raw) To: Sverre Rabbelier; +Cc: git, Junio C Hamano, Elijah Newren, Jonathan Nieder On Fri, Oct 1, 2010 at 17:39, Sverre Rabbelier <srabbelier@gmail.com> wrote: > Heya, > > On Fri, Oct 1, 2010 at 19:16, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: >> converted that code to use an external test similar no the TODO test I > > s/no/to/ Thanks, fixed. >> +cat >expect <<EOF && >> +not ok - 1 tests clean up even after a failure >> +# >> +# touch clean-after-failure && >> +# test_when_finished rm clean-after-failure && >> +# (exit 1) >> +# >> +not ok - 2 failure to clean up causes the test to fail >> +# >> +# test_when_finished \"(exit 2)\" >> +# >> +# failed 2 among 2 test(s) >> +1..2 >> +EOF >> + test_cmp expect out) > > I still like the putting-the-code-in-a-separate-harness, but I'm > wondering if we can't come up with something better than comparing > with test output that could change in the future... unless we decide > to standardize on TAP and not deviate from it? Since t0000-basic.sh is the sanity test for the test-lib.sh itself having at least some comparison of output is a good thing. It's a nice sanity check in case something ends up changing it. It's easy to change it if we change the output, but at least we'll be testing for it explicitly. > Either case, wouldn't it at least be a good idea to get rid of the > parts after the # in the comparrison? I thought it was simplest to just compare the complete output. ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCH] test-lib: make test_expect_code a test command 2010-10-01 17:46 ` Ævar Arnfjörð Bjarmason @ 2010-10-01 17:47 ` Sverre Rabbelier 0 siblings, 0 replies; 51+ messages in thread From: Sverre Rabbelier @ 2010-10-01 17:47 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason Cc: git, Junio C Hamano, Elijah Newren, Jonathan Nieder Heya, On Fri, Oct 1, 2010 at 19:46, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > Since t0000-basic.sh is the sanity test for the test-lib.sh itself > having at least some comparison of output is a good thing. It's a nice > sanity check in case something ends up changing it. > > It's easy to change it if we change the output, but at least we'll be > testing for it explicitly. > >> Either case, wouldn't it at least be a good idea to get rid of the >> parts after the # in the comparrison? > > I thought it was simplest to just compare the complete output. Ok, sounds good :) -- Cheers, Sverre Rabbelier ^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCH v2] test-lib: make test_expect_code a test command 2010-10-01 17:16 ` [PATCH] test-lib: make test_expect_code a test command Ævar Arnfjörð Bjarmason 2010-10-01 17:39 ` Sverre Rabbelier @ 2010-10-01 17:42 ` Ævar Arnfjörð Bjarmason 2010-10-01 18:55 ` [PATCH] " Jonathan Nieder 2 siblings, 0 replies; 51+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2010-10-01 17:42 UTC (permalink / raw) To: git Cc: Junio C Hamano, Elijah Newren, Jonathan Nieder, Sverre Rabbelier, Ævar Arnfjörð Bjarmason Change test_expect_code to be a normal test command instead of a top-level command. As a top-level command it would fail in cases like: test_expect_code 1 'phoney' ' foo && bar && (exit 1) ' Here the test might incorrectly succeed if "foo" or "bar" happened to fail with exit status 1. Instead we now do: test_expect_success 'phoney' ' foo && bar && test_expect_code 1 "(exit 1)" ' Which will only succeed if "foo" and "bar" return status 0, and "(exit 1)" returns status 1. Some test code in t0000-basic.sh relied on the old semantics of test_expect_code to test the test_when_finished command. I've converted that code to use an external test similar to the TODO test I added in v1.7.3-rc0~2^2~3. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- Fixed s/no the/to the/ typo in the commit message spotted by Sverre Rabbelier. t/README | 16 +++++++------ t/t0000-basic.sh | 55 ++++++++++++++++++++++++++++++++++++++-------- t/t1504-ceiling-dirs.sh | 5 ++- t/t6020-merge-df.sh | 4 ++- t/test-lib.sh | 40 ++++++++++++++++++--------------- 5 files changed, 82 insertions(+), 38 deletions(-) diff --git a/t/README b/t/README index a1eb7c8..c216e8c 100644 --- a/t/README +++ b/t/README @@ -395,13 +395,6 @@ library for your script to use. Like test_expect_success this function can optionally use a three argument invocation with a prerequisite as the first argument. - - test_expect_code [<prereq>] <code> <message> <script> - - Analogous to test_expect_success, but pass the test if it exits - with a given exit <code> - - test_expect_code 1 'Merge with d/f conflicts' 'git merge "merge msg" B master' - - test_debug <script> This takes a single argument, <script>, and evaluates it only @@ -482,6 +475,15 @@ library for your script to use. 'Perl API' \ "$PERL_PATH" "$TEST_DIRECTORY"/t9700/test.pl + - test_expect_code <exit-code> <git-command> + + Run a git command and ensure that it exits with the given exit + code. For example: + + test_expect_success 'Merge with d/f conflicts' ' + test_expect_code 1 git merge "merge msg" B master + ' + - test_must_fail <git-command> Run a git command and ensure it fails in a controlled way. Use diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index f688bd3..c2f5f8d 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -130,22 +130,57 @@ test_expect_success 'tests clean up after themselves' ' test_when_finished clean=yes ' -cleaner=no -test_expect_code 1 'tests clean up even after a failure' ' - test_when_finished cleaner=yes && - (exit 1) -' - -if test $clean$cleaner != yesyes +if test $clean != yes then - say "bug in test framework: cleanup commands do not work reliably" + say "bug in test framework: basic cleanup command does not work reliably" exit 1 fi -test_expect_code 2 'failure to clean up causes the test to fail' ' - test_when_finished "(exit 2)" +test_expect_success 'tests clean up even on failures' " + mkdir failing-cleanup && + (cd failing-cleanup && + cat >failing-cleanup.sh <<EOF && +#!$SHELL_PATH + +test_description='Failing tests with cleanup commands' + +# Point to the t/test-lib.sh, which isn't in ../ as usual +TEST_DIRECTORY=\"$TEST_DIRECTORY\" +. \"\$TEST_DIRECTORY\"/test-lib.sh + +test_expect_success 'tests clean up even after a failure' ' + touch clean-after-failure && + test_when_finished rm clean-after-failure && + (exit 1) ' +test_expect_success 'failure to clean up causes the test to fail' ' + test_when_finished \"(exit 2)\" +' + +test_done +EOF + chmod +x failing-cleanup.sh && + test_must_fail ./failing-cleanup.sh >out 2>err && + ! test -s err && + ! test -f \"trash directory.failing-cleanup/clean-after-failure\" && +cat >expect <<EOF && +not ok - 1 tests clean up even after a failure +# +# touch clean-after-failure && +# test_when_finished rm clean-after-failure && +# (exit 1) +# +not ok - 2 failure to clean up causes the test to fail +# +# test_when_finished \"(exit 2)\" +# +# failed 2 among 2 test(s) +1..2 +EOF + test_cmp expect out) +" + ################################################################ # Basics of the basics diff --git a/t/t1504-ceiling-dirs.sh b/t/t1504-ceiling-dirs.sh index df5ad8c..cce87a5 100755 --- a/t/t1504-ceiling-dirs.sh +++ b/t/t1504-ceiling-dirs.sh @@ -9,8 +9,9 @@ test_prefix() { } test_fail() { - test_expect_code 128 "$1: prefix" \ - "git rev-parse --show-prefix" + test_expect_success "$1: prefix" ' + test_expect_code 128 git rev-parse --show-prefix + ' } TRASH_ROOT="$PWD" diff --git a/t/t6020-merge-df.sh b/t/t6020-merge-df.sh index 490d397..5d91d05 100755 --- a/t/t6020-merge-df.sh +++ b/t/t6020-merge-df.sh @@ -20,7 +20,9 @@ echo "file dir" > dir && git add dir && git commit -m "File: dir"' -test_expect_code 1 'Merge with d/f conflicts' 'git merge "merge msg" B master' +test_expect_success 'Merge with d/f conflicts' ' + test_expect_code 1 git merge "merge msg" B master +' test_expect_success 'F/D conflict' ' git reset --hard && diff --git a/t/test-lib.sh b/t/test-lib.sh index 830e5e7..d86edcd 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -473,24 +473,6 @@ test_expect_success () { echo >&3 "" } -test_expect_code () { - test "$#" = 4 && { prereq=$1; shift; } || prereq= - test "$#" = 3 || - error "bug in the test script: not 3 or 4 parameters to test-expect-code" - if ! test_skip "$@" - then - say >&3 "expecting exit code $1: $3" - test_run_ "$3" - if [ "$?" = 0 -a "$eval_ret" = "$1" ] - then - test_ok_ "$2" - else - test_failure_ "$@" - fi - fi - echo >&3 "" -} - # test_external runs external test scripts that provide continuous # test output about their progress, and succeeds/fails on # zero/non-zero exit code. It outputs the test output on stdout even @@ -658,6 +640,28 @@ test_might_fail () { return 0 } +# Similar to test_must_fail and test_might_fail, but check that a +# given command exited with a given exit code. Meant to be used as: +# +# test_expect_success 'Merge with d/f conflicts' ' +# test_expect_code 1 git merge "merge msg" B master +# ' + +test_expect_code () { + want_code=$1 + shift + "$@" + exit_code=$? + if test $exit_code = $want_code + then + echo >&2 "test_expect_code: command exited with $exit_code: $*" + return 0 + else + echo >&2 "test_expect_code: command exited with $exit_code, we wanted $want_code $*" + return 1 + fi +} + # test_cmp is a helper function to compare actual and expected output. # You can use it like: # -- 1.7.3.159.g610493 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCH] test-lib: make test_expect_code a test command 2010-10-01 17:16 ` [PATCH] test-lib: make test_expect_code a test command Ævar Arnfjörð Bjarmason 2010-10-01 17:39 ` Sverre Rabbelier 2010-10-01 17:42 ` [PATCH v2] " Ævar Arnfjörð Bjarmason @ 2010-10-01 18:55 ` Jonathan Nieder 2 siblings, 0 replies; 51+ messages in thread From: Jonathan Nieder @ 2010-10-01 18:55 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason; +Cc: git, Junio C Hamano, Elijah Newren Ævar Arnfjörð Bjarmason wrote: > Change test_expect_code to be a normal test command instead of a > top-level command. I like it. New code that uses test_expect_code in the old sense would be easily caught because the title description tends not to be the name of a command. Thanks for making the test suite a little saner. ^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCHv4 03/15] t100[12] (read-tree-m-2way, read_tree_m_u_2way): add missing && 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren 2010-09-26 23:14 ` [PATCHv4 01/15] t3020 (ls-files-error-unmatch): remove stray '1' from end of file Elijah Newren 2010-09-26 23:14 ` [PATCHv4 02/15] t4017 (diff-retval): replace manual exit code check with test_expect_code Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-09-29 18:28 ` Junio C Hamano 2010-09-26 23:14 ` [PATCHv4 04/15] t4002 (diff-basic): use test_might_fail for commands that might fail Elijah Newren ` (11 subsequent siblings) 14 siblings, 1 reply; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Also, replace "|| return 1" with "&&" in order to keep commands chained. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t1001-read-tree-m-2way.sh | 18 +++++++++--------- t/t1002-read-tree-m-u-2way.sh | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh index 93ca84f..ce8112c 100755 --- a/t/t1001-read-tree-m-2way.sh +++ b/t/t1001-read-tree-m-2way.sh @@ -98,8 +98,8 @@ test_expect_success \ git checkout-index -u -f -q -a && git update-index --add yomin && read_tree_twoway $treeH $treeM && - git ls-files --stage >4.out || return 1 - git diff --no-index M.out 4.out >4diff.out + git ls-files --stage >4.out && + test_might_fail git diff --no-index M.out 4.out >4diff.out && compare_change 4diff.out expected && check_cache_at yomin clean' @@ -112,8 +112,8 @@ test_expect_success \ git update-index --add yomin && echo yomin yomin >yomin && read_tree_twoway $treeH $treeM && - git ls-files --stage >5.out || return 1 - git diff --no-index M.out 5.out >5diff.out + git ls-files --stage >5.out && + test_might_fail git diff --no-index M.out 5.out >5diff.out && compare_change 5diff.out expected && check_cache_at yomin dirty' @@ -213,8 +213,8 @@ test_expect_success \ echo nitfol nitfol >nitfol && git update-index --add nitfol && read_tree_twoway $treeH $treeM && - git ls-files --stage >14.out || return 1 - git diff --no-index M.out 14.out >14diff.out + git ls-files --stage >14.out && + test_might_fail git diff --no-index M.out 14.out >14diff.out && compare_change 14diff.out expected && check_cache_at nitfol clean' @@ -227,8 +227,8 @@ test_expect_success \ git update-index --add nitfol && echo nitfol nitfol nitfol >nitfol && read_tree_twoway $treeH $treeM && - git ls-files --stage >15.out || return 1 - git diff --no-index M.out 15.out >15diff.out + git ls-files --stage >15.out && + test_might_fail git diff --no-index M.out 15.out >15diff.out && compare_change 15diff.out expected && check_cache_at nitfol dirty' @@ -377,7 +377,7 @@ test_expect_success \ git ls-files --stage >treeM.out && rm -f a && - mkdir a + mkdir a && : >a/b && git update-index --add --remove a a/b && treeH=`git write-tree` && diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh index 0241329..a9492e9 100755 --- a/t/t1002-read-tree-m-u-2way.sh +++ b/t/t1002-read-tree-m-u-2way.sh @@ -205,8 +205,8 @@ test_expect_success \ echo nitfol nitfol >nitfol && git update-index --add nitfol && git read-tree -m -u $treeH $treeM && - git ls-files --stage >14.out || return 1 - git diff -U0 --no-index M.out 14.out >14diff.out + git ls-files --stage >14.out && + test_might_fail git diff -U0 --no-index M.out 14.out >14diff.out && compare_change 14diff.out expected && sum bozbar frotz >actual14.sum && grep -v nitfol M.sum > expected14.sum && @@ -226,8 +226,8 @@ test_expect_success \ git update-index --add nitfol && echo nitfol nitfol nitfol >nitfol && git read-tree -m -u $treeH $treeM && - git ls-files --stage >15.out || return 1 - git diff -U0 --no-index M.out 15.out >15diff.out + git ls-files --stage >15.out && + test_might_fail git diff -U0 --no-index M.out 15.out >15diff.out && compare_change 15diff.out expected && check_cache_at nitfol dirty && sum bozbar frotz >actual15.sum && @@ -314,7 +314,7 @@ test_expect_success \ # Also make sure we did not break DF vs DF/DF case. test_expect_success \ 'DF vs DF/DF case setup.' \ - 'rm -f .git/index + 'rm -f .git/index && echo DF >DF && git update-index --add DF && treeDF=`git write-tree` && -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCHv4 03/15] t100[12] (read-tree-m-2way, read_tree_m_u_2way): add missing && 2010-09-26 23:14 ` [PATCHv4 03/15] t100[12] (read-tree-m-2way, read_tree_m_u_2way): add missing && Elijah Newren @ 2010-09-29 18:28 ` Junio C Hamano 2010-10-01 10:27 ` Jonathan Nieder 0 siblings, 1 reply; 51+ messages in thread From: Junio C Hamano @ 2010-09-29 18:28 UTC (permalink / raw) To: Elijah Newren; +Cc: git, gitster Elijah Newren <newren@gmail.com> writes: > Also, replace "|| return 1" with "&&" in order to keep commands chained. > > Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> > Signed-off-by: Elijah Newren <newren@gmail.com> > --- > t/t1001-read-tree-m-2way.sh | 18 +++++++++--------- > t/t1002-read-tree-m-u-2way.sh | 10 +++++----- > 2 files changed, 14 insertions(+), 14 deletions(-) > > diff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh > index 93ca84f..ce8112c 100755 > --- a/t/t1001-read-tree-m-2way.sh > +++ b/t/t1001-read-tree-m-2way.sh > @@ -98,8 +98,8 @@ test_expect_success \ > git checkout-index -u -f -q -a && > git update-index --add yomin && > read_tree_twoway $treeH $treeM && > - git ls-files --stage >4.out || return 1 > - git diff --no-index M.out 4.out >4diff.out > + git ls-files --stage >4.out && > + test_might_fail git diff --no-index M.out 4.out >4diff.out && Shouldn't this be must-fail, as we are expecting to see some differences? > compare_change 4diff.out expected && > check_cache_at yomin clean' > > @@ -112,8 +112,8 @@ test_expect_success \ > git update-index --add yomin && > echo yomin yomin >yomin && > read_tree_twoway $treeH $treeM && > - git ls-files --stage >5.out || return 1 > - git diff --no-index M.out 5.out >5diff.out > + git ls-files --stage >5.out && > + test_might_fail git diff --no-index M.out 5.out >5diff.out && Ditto. > compare_change 5diff.out expected && > check_cache_at yomin dirty' > > @@ -213,8 +213,8 @@ test_expect_success \ > echo nitfol nitfol >nitfol && > git update-index --add nitfol && > read_tree_twoway $treeH $treeM && > - git ls-files --stage >14.out || return 1 > - git diff --no-index M.out 14.out >14diff.out > + git ls-files --stage >14.out && > + test_might_fail git diff --no-index M.out 14.out >14diff.out && Ditto. > compare_change 14diff.out expected && > check_cache_at nitfol clean' > > @@ -227,8 +227,8 @@ test_expect_success \ > git update-index --add nitfol && > echo nitfol nitfol nitfol >nitfol && > read_tree_twoway $treeH $treeM && > - git ls-files --stage >15.out || return 1 > - git diff --no-index M.out 15.out >15diff.out > + git ls-files --stage >15.out && > + test_might_fail git diff --no-index M.out 15.out >15diff.out && Ditto. > compare_change 15diff.out expected && > check_cache_at nitfol dirty' > > @@ -377,7 +377,7 @@ test_expect_success \ > git ls-files --stage >treeM.out && > > rm -f a && > - mkdir a > + mkdir a && > : >a/b && > git update-index --add --remove a a/b && > treeH=`git write-tree` && > diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh > index 0241329..a9492e9 100755 > --- a/t/t1002-read-tree-m-u-2way.sh > +++ b/t/t1002-read-tree-m-u-2way.sh > @@ -205,8 +205,8 @@ test_expect_success \ > echo nitfol nitfol >nitfol && > git update-index --add nitfol && > git read-tree -m -u $treeH $treeM && > - git ls-files --stage >14.out || return 1 > - git diff -U0 --no-index M.out 14.out >14diff.out > + git ls-files --stage >14.out && > + test_might_fail git diff -U0 --no-index M.out 14.out >14diff.out && Ditto. > compare_change 14diff.out expected && > sum bozbar frotz >actual14.sum && > grep -v nitfol M.sum > expected14.sum && > @@ -226,8 +226,8 @@ test_expect_success \ > git update-index --add nitfol && > echo nitfol nitfol nitfol >nitfol && > git read-tree -m -u $treeH $treeM && > - git ls-files --stage >15.out || return 1 > - git diff -U0 --no-index M.out 15.out >15diff.out > + git ls-files --stage >15.out && > + test_might_fail git diff -U0 --no-index M.out 15.out >15diff.out && Ditto. > compare_change 15diff.out expected && > check_cache_at nitfol dirty && > sum bozbar frotz >actual15.sum && > @@ -314,7 +314,7 @@ test_expect_success \ > # Also make sure we did not break DF vs DF/DF case. > test_expect_success \ > 'DF vs DF/DF case setup.' \ > - 'rm -f .git/index > + 'rm -f .git/index && > echo DF >DF && > git update-index --add DF && > treeDF=`git write-tree` && > -- > 1.7.3.95.g14291 ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 03/15] t100[12] (read-tree-m-2way, read_tree_m_u_2way): add missing && 2010-09-29 18:28 ` Junio C Hamano @ 2010-10-01 10:27 ` Jonathan Nieder 0 siblings, 0 replies; 51+ messages in thread From: Jonathan Nieder @ 2010-10-01 10:27 UTC (permalink / raw) To: Junio C Hamano; +Cc: Elijah Newren, git Junio C Hamano wrote: > Elijah Newren <newren@gmail.com> writes: >> --- a/t/t1001-read-tree-m-2way.sh >> +++ b/t/t1001-read-tree-m-2way.sh >> @@ -98,8 +98,8 @@ test_expect_success \ >> git checkout-index -u -f -q -a && >> git update-index --add yomin && >> read_tree_twoway $treeH $treeM && >> - git ls-files --stage >4.out || return 1 >> - git diff --no-index M.out 4.out >4diff.out >> + git ls-files --stage >4.out && >> + test_might_fail git diff --no-index M.out 4.out >4diff.out && > > Shouldn't this be must-fail, as we are expecting to see some differences? I see you've fixed this up already. Thanks. ^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCHv4 04/15] t4002 (diff-basic): use test_might_fail for commands that might fail 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren ` (2 preceding siblings ...) 2010-09-26 23:14 ` [PATCHv4 03/15] t100[12] (read-tree-m-2way, read_tree_m_u_2way): add missing && Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-10-01 10:35 ` Jonathan Nieder 2010-09-26 23:14 ` [PATCHv4 05/15] t4202 (log): Replace '<git-command> || :' with test_might_fail Elijah Newren ` (10 subsequent siblings) 14 siblings, 1 reply; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Also replace '|| return 1' by '&&' to allow chain of operations to be checked for proper return status. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t4002-diff-basic.sh | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh index 73441a5..340aa7d 100755 --- a/t/t4002-diff-basic.sh +++ b/t/t4002-diff-basic.sh @@ -205,8 +205,8 @@ test_expect_success \ 'rm -fr Z [A-Z][A-Z] && git read-tree $tree_A && git checkout-index -f -a && - git read-tree --reset $tree_O || return 1 - git update-index --refresh >/dev/null ;# this can exit non-zero + git read-tree --reset $tree_O && + test_might_fail git update-index --refresh >/dev/null && git diff-files >.test-a && cmp_diff_files_output .test-a .test-recursive-OA' @@ -215,8 +215,8 @@ test_expect_success \ 'rm -fr Z [A-Z][A-Z] && git read-tree $tree_B && git checkout-index -f -a && - git read-tree --reset $tree_O || return 1 - git update-index --refresh >/dev/null ;# this can exit non-zero + git read-tree --reset $tree_O && + test_might_fail git update-index --refresh >/dev/null && git diff-files >.test-a && cmp_diff_files_output .test-a .test-recursive-OB' @@ -225,8 +225,8 @@ test_expect_success \ 'rm -fr Z [A-Z][A-Z] && git read-tree $tree_B && git checkout-index -f -a && - git read-tree --reset $tree_A || return 1 - git update-index --refresh >/dev/null ;# this can exit non-zero + git read-tree --reset $tree_A && + test_might_fail git update-index --refresh >/dev/null && git diff-files >.test-a && cmp_diff_files_output .test-a .test-recursive-AB' -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCHv4 04/15] t4002 (diff-basic): use test_might_fail for commands that might fail 2010-09-26 23:14 ` [PATCHv4 04/15] t4002 (diff-basic): use test_might_fail for commands that might fail Elijah Newren @ 2010-10-01 10:35 ` Jonathan Nieder 0 siblings, 0 replies; 51+ messages in thread From: Jonathan Nieder @ 2010-10-01 10:35 UTC (permalink / raw) To: Elijah Newren; +Cc: git, gitster Elijah Newren wrote: > --- a/t/t4002-diff-basic.sh > +++ b/t/t4002-diff-basic.sh > @@ -205,8 +205,8 @@ test_expect_success \ > 'rm -fr Z [A-Z][A-Z] && > git read-tree $tree_A && > git checkout-index -f -a && > - git read-tree --reset $tree_O || return 1 > - git update-index --refresh >/dev/null ;# this can exit non-zero > + git read-tree --reset $tree_O && > + test_might_fail git update-index --refresh >/dev/null && > git diff-files >.test-a && Makes sense; thanks. But aren't we actually guaranteed that it will fail, since the index does not match the work tree? Meanwhile, what was the point of refreshing the index like this? I would guess it was to make sure that files that match the work tree are marked as matching, but if so, this is not guaranteed if update-index --refresh exits early. Adding -q would fix that. Why redirect to /dev/null? I would think the extra output would be useful while debugging with -v. --- diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh index 340aa7d..9fb8ca0 100755 --- a/t/t4002-diff-basic.sh +++ b/t/t4002-diff-basic.sh @@ -206,7 +206,7 @@ test_expect_success \ git read-tree $tree_A && git checkout-index -f -a && git read-tree --reset $tree_O && - test_might_fail git update-index --refresh >/dev/null && + test_must_fail git update-index --refresh -q && git diff-files >.test-a && cmp_diff_files_output .test-a .test-recursive-OA' @@ -216,7 +216,7 @@ test_expect_success \ git read-tree $tree_B && git checkout-index -f -a && git read-tree --reset $tree_O && - test_might_fail git update-index --refresh >/dev/null && + test_must_fail git update-index --refresh -q && git diff-files >.test-a && cmp_diff_files_output .test-a .test-recursive-OB' @@ -226,7 +226,7 @@ test_expect_success \ git read-tree $tree_B && git checkout-index -f -a && git read-tree --reset $tree_A && - test_might_fail git update-index --refresh >/dev/null && + test_must_fail git update-index --refresh -q && git diff-files >.test-a && cmp_diff_files_output .test-a .test-recursive-AB' -- ^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCHv4 05/15] t4202 (log): Replace '<git-command> || :' with test_might_fail 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren ` (3 preceding siblings ...) 2010-09-26 23:14 ` [PATCHv4 04/15] t4002 (diff-basic): use test_might_fail for commands that might fail Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-09-26 23:14 ` [PATCHv4 06/15] t3600 (rm): add lots of missing && Elijah Newren ` (9 subsequent siblings) 14 siblings, 0 replies; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t4202-log.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 2e51356..1172e45 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -393,7 +393,7 @@ test_expect_success 'log --graph with merge' ' ' test_expect_success 'log.decorate configuration' ' - git config --unset-all log.decorate || : + test_might_fail git config --unset-all log.decorate && git log --oneline >expect.none && git log --oneline --decorate >expect.short && -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCHv4 06/15] t3600 (rm): add lots of missing && 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren ` (4 preceding siblings ...) 2010-09-26 23:14 ` [PATCHv4 05/15] t4202 (log): Replace '<git-command> || :' with test_might_fail Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-10-01 10:48 ` Jonathan Nieder 2010-09-26 23:14 ` [PATCHv4 07/15] t4019 (diff-wserror): " Elijah Newren ` (8 subsequent siblings) 14 siblings, 1 reply; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Also delete unnecessary, failing code and add some test_when_finished calls to make sure tests clean up after themselves. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t3600-rm.sh | 38 +++++++++++++++++--------------------- 1 files changed, 17 insertions(+), 21 deletions(-) diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index b26cabd..b1f9abf 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -38,37 +38,33 @@ test_expect_success \ test_expect_success \ 'Test that git rm --cached foo succeeds if the index matches the file' \ - 'echo content > foo - git add foo + 'echo content > foo && + git add foo && git rm --cached foo' test_expect_success \ 'Test that git rm --cached foo succeeds if the index matches the file' \ - 'echo content > foo - git add foo - git commit -m foo - echo "other content" > foo + 'echo content > foo && + git add foo && + git commit -m foo && + echo "other content" > foo && + test_when_finished "git checkout HEAD -- foo" && git rm --cached foo' test_expect_success \ 'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' ' - echo content > foo - git add foo - git commit -m foo - echo "other content" > foo - git add foo - echo "yet another content" > foo + echo "other content" > foo && + git add foo && + echo "yet another content" > foo && + test_when_finished "git checkout HEAD -- foo" && test_must_fail git rm --cached foo ' test_expect_success \ 'Test that git rm --cached -f foo works in case where --cached only did not' \ - 'echo content > foo - git add foo - git commit -m foo - echo "other content" > foo - git add foo - echo "yet another content" > foo + 'echo "other content" > foo && + git add foo && + echo "yet another content" > foo && git rm --cached -f foo' test_expect_success \ @@ -170,7 +166,7 @@ test_expect_success 'but with -f it should work.' ' git rm -f foo baz && test ! -f foo && 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 ' @@ -183,7 +179,7 @@ test_expect_success 'refuse to remove cached empty file with modifications' ' test_expect_success 'remove intent-to-add file without --force' ' echo content >intent-to-add && - git add -N intent-to-add + git add -N intent-to-add && git rm --cached intent-to-add ' @@ -201,7 +197,7 @@ test_expect_success 'Recursive without -r fails' ' ' test_expect_success 'Recursive with -r but dirty' ' - echo qfwfq >>frotz/nitfol + echo qfwfq >>frotz/nitfol && test_must_fail git rm -r frotz && test -d frotz && test -f frotz/nitfol -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCHv4 06/15] t3600 (rm): add lots of missing && 2010-09-26 23:14 ` [PATCHv4 06/15] t3600 (rm): add lots of missing && Elijah Newren @ 2010-10-01 10:48 ` Jonathan Nieder 2010-10-03 2:47 ` Elijah Newren 0 siblings, 1 reply; 51+ messages in thread From: Jonathan Nieder @ 2010-10-01 10:48 UTC (permalink / raw) To: Elijah Newren; +Cc: git, gitster Elijah Newren wrote: > Also delete unnecessary, failing code and add some test_when_finished > calls to make sure tests clean up after themselves. I don't understand this one. If tests clean up after themselves, each will restore some pristine state as though (at least as far as the other tests care) it had never run at all, right? > --- a/t/t3600-rm.sh > +++ b/t/t3600-rm.sh > @@ -38,37 +38,33 @@ test_expect_success \ > > test_expect_success \ > 'Test that git rm --cached foo succeeds if the index matches the file' \ > - 'echo content > foo > - git add foo > + 'echo content > foo && > + git add foo && > git rm --cached foo' Before this runs: foo is empty, absent from index. After it runs: foo has content, still absent from index. Requires: nothing. > test_expect_success \ > 'Test that git rm --cached foo succeeds if the index matches the file' \ > - 'echo content > foo > - git add foo > - git commit -m foo > - echo "other content" > foo > + 'echo content > foo && > + git add foo && > + git commit -m foo && > + echo "other content" > foo && > + test_when_finished "git checkout HEAD -- foo" && > git rm --cached foo' Before this runs: foo has content, absent from index. After this runs (without patch): foo has other content, absent from index. After this runs (with patch): foo has content, matching index. Requires: nothing. > test_expect_success \ > 'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' ' > - echo content > foo > - git add foo > - git commit -m foo > - echo "other content" > foo > - git add foo > - echo "yet another content" > foo > + echo "other content" > foo && > + git add foo && > + echo "yet another content" > foo && > + test_when_finished "git checkout HEAD -- foo" && > test_must_fail git rm --cached foo > ' Before this runs: see above. After this runs (without patch): foo has yet another content, absent from index. After this runs (with patch): foo has content, matching index. Requires (without patch): nothing. Requires (with patch): HEAD:foo is content. [etc] So if I understand correctly, this sacrifices the ability to skip individual tests. What does one gain in return? ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 06/15] t3600 (rm): add lots of missing && 2010-10-01 10:48 ` Jonathan Nieder @ 2010-10-03 2:47 ` Elijah Newren 0 siblings, 0 replies; 51+ messages in thread From: Elijah Newren @ 2010-10-03 2:47 UTC (permalink / raw) To: Jonathan Nieder; +Cc: git, gitster On Fri, Oct 1, 2010 at 4:48 AM, Jonathan Nieder <jrnieder@gmail.com> wrote: > Elijah Newren wrote: > >> Also delete unnecessary, failing code and add some test_when_finished >> calls to make sure tests clean up after themselves. > > I don't understand this one. > > If tests clean up after themselves, each will restore some pristine > state as though (at least as far as the other tests care) it had never > run at all, right? > >> --- a/t/t3600-rm.sh >> +++ b/t/t3600-rm.sh >> @@ -38,37 +38,33 @@ test_expect_success \ >> >> test_expect_success \ >> 'Test that git rm --cached foo succeeds if the index matches the file' \ >> - 'echo content > foo >> - git add foo >> + 'echo content > foo && >> + git add foo && >> git rm --cached foo' > > Before this runs: foo is empty, absent from index. > After it runs: foo has content, still absent from index. > Requires: nothing. > >> test_expect_success \ >> 'Test that git rm --cached foo succeeds if the index matches the file' \ >> - 'echo content > foo >> - git add foo >> - git commit -m foo >> - echo "other content" > foo >> + 'echo content > foo && >> + git add foo && >> + git commit -m foo && >> + echo "other content" > foo && >> + test_when_finished "git checkout HEAD -- foo" && >> git rm --cached foo' > > Before this runs: foo has content, absent from index. > After this runs (without patch): foo has other content, absent from index. > After this runs (with patch): foo has content, matching index. > Requires: nothing. > >> test_expect_success \ >> 'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' ' >> - echo content > foo >> - git add foo >> - git commit -m foo >> - echo "other content" > foo >> - git add foo >> - echo "yet another content" > foo >> + echo "other content" > foo && >> + git add foo && >> + echo "yet another content" > foo && >> + test_when_finished "git checkout HEAD -- foo" && >> test_must_fail git rm --cached foo >> ' > > Before this runs: see above. > After this runs (without patch): foo has yet another content, absent from index. > After this runs (with patch): foo has content, matching index. > Requires (without patch): nothing. > Requires (with patch): HEAD:foo is content. > > [etc] > > So if I understand correctly, this sacrifices the ability to > skip individual tests. What does one gain in return? Good eye. It does remove failing code and add correct && chaining, but yes, it will fail if you skip sufficiently many individual tests. I believe my original patch submission (http://article.gmane.org/gmane.comp.version-control.git/157080) does not suffer from this same problem. Should I revert to it? Elijah ^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCHv4 07/15] t4019 (diff-wserror): add lots of missing && 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren ` (5 preceding siblings ...) 2010-09-26 23:14 ` [PATCHv4 06/15] t3600 (rm): add lots of missing && Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-09-29 19:01 ` Junio C Hamano 2010-10-01 11:00 ` Jonathan Nieder 2010-09-26 23:14 ` [PATCHv4 08/15] t4026 (color): remove unneeded and unchained command Elijah Newren ` (7 subsequent siblings) 14 siblings, 2 replies; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Also add a test_might_fail in front of the final git_config --unset core.whitespace as that value may have already been unset previously. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t4019-diff-wserror.sh | 52 +++++++++++++++++++++++----------------------- 1 files changed, 26 insertions(+), 26 deletions(-) diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh index f6d1f1e..2557ec7 100755 --- a/t/t4019-diff-wserror.sh +++ b/t/t4019-diff-wserror.sh @@ -40,7 +40,7 @@ prepare_output () { test_expect_success default ' - prepare_output + prepare_output && grep Eight normal >/dev/null && grep HT error >/dev/null && @@ -52,8 +52,8 @@ test_expect_success default ' test_expect_success 'without -trail' ' - git config core.whitespace -trail - prepare_output + git config core.whitespace -trail && + prepare_output && grep Eight normal >/dev/null && grep HT error >/dev/null && @@ -65,9 +65,9 @@ test_expect_success 'without -trail' ' test_expect_success 'without -trail (attribute)' ' - git config --unset core.whitespace - echo "F whitespace=-trail" >.gitattributes - prepare_output + git config --unset core.whitespace && + echo "F whitespace=-trail" >.gitattributes && + prepare_output && grep Eight normal >/dev/null && grep HT error >/dev/null && @@ -79,9 +79,9 @@ test_expect_success 'without -trail (attribute)' ' test_expect_success 'without -space' ' - rm -f .gitattributes - git config core.whitespace -space - prepare_output + rm -f .gitattributes && + git config core.whitespace -space && + prepare_output && grep Eight normal >/dev/null && grep HT normal >/dev/null && @@ -93,9 +93,9 @@ test_expect_success 'without -space' ' test_expect_success 'without -space (attribute)' ' - git config --unset core.whitespace - echo "F whitespace=-space" >.gitattributes - prepare_output + git config --unset core.whitespace && + echo "F whitespace=-space" >.gitattributes && + prepare_output && grep Eight normal >/dev/null && grep HT normal >/dev/null && @@ -107,9 +107,9 @@ test_expect_success 'without -space (attribute)' ' test_expect_success 'with indent-non-tab only' ' - rm -f .gitattributes - git config core.whitespace indent,-trailing,-space - prepare_output + rm -f .gitattributes && + git config core.whitespace indent,-trailing,-space && + prepare_output && grep Eight error >/dev/null && grep HT normal >/dev/null && @@ -121,9 +121,9 @@ test_expect_success 'with indent-non-tab only' ' test_expect_success 'with indent-non-tab only (attribute)' ' - git config --unset core.whitespace - echo "F whitespace=indent,-trailing,-space" >.gitattributes - prepare_output + git config --unset core.whitespace && + echo "F whitespace=indent,-trailing,-space" >.gitattributes && + prepare_output && grep Eight error >/dev/null && grep HT normal >/dev/null && @@ -135,9 +135,9 @@ test_expect_success 'with indent-non-tab only (attribute)' ' test_expect_success 'with cr-at-eol' ' - rm -f .gitattributes - git config core.whitespace cr-at-eol - prepare_output + rm -f .gitattributes && + git config core.whitespace cr-at-eol && + prepare_output && grep Eight normal >/dev/null && grep HT error >/dev/null && @@ -149,9 +149,9 @@ test_expect_success 'with cr-at-eol' ' test_expect_success 'with cr-at-eol (attribute)' ' - git config --unset core.whitespace - echo "F whitespace=trailing,cr-at-eol" >.gitattributes - prepare_output + git config --unset core.whitespace && + echo "F whitespace=trailing,cr-at-eol" >.gitattributes && + prepare_output && grep Eight normal >/dev/null && grep HT error >/dev/null && @@ -179,11 +179,11 @@ test_expect_success 'trailing empty lines (2)' ' ' test_expect_success 'do not color trailing cr in context' ' - git config --unset core.whitespace + test_might_fail git config --unset core.whitespace && rm -f .gitattributes && echo AAAQ | tr Q "\015" >G && git add G && - echo BBBQ | tr Q "\015" >>G + echo BBBQ | tr Q "\015" >>G && git diff --color G | tr "\015" Q >output && grep "BBB.*${blue_grep}Q" output && grep "AAA.*\[mQ" output -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCHv4 07/15] t4019 (diff-wserror): add lots of missing && 2010-09-26 23:14 ` [PATCHv4 07/15] t4019 (diff-wserror): " Elijah Newren @ 2010-09-29 19:01 ` Junio C Hamano 2010-10-03 3:03 ` Elijah Newren 2010-10-01 11:00 ` Jonathan Nieder 1 sibling, 1 reply; 51+ messages in thread From: Junio C Hamano @ 2010-09-29 19:01 UTC (permalink / raw) To: Elijah Newren; +Cc: git Elijah Newren <newren@gmail.com> writes: > Also add a test_might_fail in front of the final git_config --unset > core.whitespace as that value may have already been unset previously. In general, if a previous one that is designed to set a variable failed for whatever reason, the next one that does --unset without might-fail will be broken. So... > @@ -65,9 +65,9 @@ test_expect_success 'without -trail' ' > > test_expect_success 'without -trail (attribute)' ' > > - git config --unset core.whitespace > - echo "F whitespace=-trail" >.gitattributes > - prepare_output > + git config --unset core.whitespace && ... I think you need might-fail in front of this one, and ... > + echo "F whitespace=-trail" >.gitattributes && > + prepare_output && > > grep Eight normal >/dev/null && > grep HT error >/dev/null && > @@ -79,9 +79,9 @@ test_expect_success 'without -trail (attribute)' ' > > test_expect_success 'without -space' ' > > - rm -f .gitattributes > - git config core.whitespace -space > - prepare_output > + rm -f .gitattributes && > + git config core.whitespace -space && > + prepare_output && > > grep Eight normal >/dev/null && > grep HT normal >/dev/null && > @@ -93,9 +93,9 @@ test_expect_success 'without -space' ' > > test_expect_success 'without -space (attribute)' ' > > - git config --unset core.whitespace > - echo "F whitespace=-space" >.gitattributes > - prepare_output > + git config --unset core.whitespace && ... this one, ... > + echo "F whitespace=-space" >.gitattributes && > + prepare_output && > > grep Eight normal >/dev/null && > grep HT normal >/dev/null && > @@ -107,9 +107,9 @@ test_expect_success 'without -space (attribute)' ' > > test_expect_success 'with indent-non-tab only' ' > > - rm -f .gitattributes > - git config core.whitespace indent,-trailing,-space > - prepare_output > + rm -f .gitattributes && > + git config core.whitespace indent,-trailing,-space && ... this one, ... > + prepare_output && > > grep Eight error >/dev/null && > grep HT normal >/dev/null && > @@ -121,9 +121,9 @@ test_expect_success 'with indent-non-tab only' ' > > test_expect_success 'with indent-non-tab only (attribute)' ' > > - git config --unset core.whitespace > - echo "F whitespace=indent,-trailing,-space" >.gitattributes > - prepare_output > + git config --unset core.whitespace && ... this one, ... > + echo "F whitespace=indent,-trailing,-space" >.gitattributes && > + prepare_output && > > grep Eight error >/dev/null && > grep HT normal >/dev/null && > @@ -135,9 +135,9 @@ test_expect_success 'with indent-non-tab only (attribute)' ' > > test_expect_success 'with cr-at-eol' ' > > - rm -f .gitattributes > - git config core.whitespace cr-at-eol > - prepare_output > + rm -f .gitattributes && > + git config core.whitespace cr-at-eol && > + prepare_output && > > grep Eight normal >/dev/null && > grep HT error >/dev/null && > @@ -149,9 +149,9 @@ test_expect_success 'with cr-at-eol' ' > > test_expect_success 'with cr-at-eol (attribute)' ' > > - git config --unset core.whitespace > - echo "F whitespace=trailing,cr-at-eol" >.gitattributes > - prepare_output > + git config --unset core.whitespace && ... and this one, too. > + echo "F whitespace=trailing,cr-at-eol" >.gitattributes && > + prepare_output && > > grep Eight normal >/dev/null && > grep HT error >/dev/null && > @@ -179,11 +179,11 @@ test_expect_success 'trailing empty lines (2)' ' > ' > > test_expect_success 'do not color trailing cr in context' ' > - git config --unset core.whitespace > + test_might_fail git config --unset core.whitespace && > rm -f .gitattributes && > echo AAAQ | tr Q "\015" >G && > git add G && > - echo BBBQ | tr Q "\015" >>G > + echo BBBQ | tr Q "\015" >>G && > git diff --color G | tr "\015" Q >output && > grep "BBB.*${blue_grep}Q" output && > grep "AAA.*\[mQ" output > -- > 1.7.3.95.g14291 ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 07/15] t4019 (diff-wserror): add lots of missing && 2010-09-29 19:01 ` Junio C Hamano @ 2010-10-03 3:03 ` Elijah Newren 0 siblings, 0 replies; 51+ messages in thread From: Elijah Newren @ 2010-10-03 3:03 UTC (permalink / raw) To: Junio C Hamano; +Cc: git Hi, On Wed, Sep 29, 2010 at 1:01 PM, Junio C Hamano <gitster@pobox.com> wrote: >> Also add a test_might_fail in front of the final git_config --unset >> core.whitespace as that value may have already been unset previously. > > In general, if a previous one that is designed to set a variable failed > for whatever reason, the next one that does --unset without might-fail > will be broken. So... > [...] >> + git config --unset core.whitespace && > > ... I think you need might-fail in front of this one, and ... [...] > >> + echo "F whitespace=-space" >.gitattributes && >> + prepare_output && >> >> grep Eight normal >/dev/null && >> grep HT normal >/dev/null && >> @@ -107,9 +107,9 @@ test_expect_success 'without -space (attribute)' ' >> >> test_expect_success 'with indent-non-tab only' ' >> >> - rm -f .gitattributes >> - git config core.whitespace indent,-trailing,-space >> - prepare_output >> + rm -f .gitattributes && >> + git config core.whitespace indent,-trailing,-space && > > ... this one, ... I fixed the others you pointed out, but elsewhere you were talking about git config --unset and the --unset option is not being used here. Is there another reason this config command needs one? ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 07/15] t4019 (diff-wserror): add lots of missing && 2010-09-26 23:14 ` [PATCHv4 07/15] t4019 (diff-wserror): " Elijah Newren 2010-09-29 19:01 ` Junio C Hamano @ 2010-10-01 11:00 ` Jonathan Nieder 1 sibling, 0 replies; 51+ messages in thread From: Jonathan Nieder @ 2010-10-01 11:00 UTC (permalink / raw) To: Elijah Newren; +Cc: git, gitster Elijah Newren wrote: > --- a/t/t4019-diff-wserror.sh > +++ b/t/t4019-diff-wserror.sh > @@ -40,7 +40,7 @@ prepare_output () { > > test_expect_success default ' > > - prepare_output > + prepare_output && The exit status from prepare_output is the exit status from its last command, which is "grep -v <something blue>". It seems that never fails in these test cases, but should we be relying on that? (I haven't thought hard about the answer. If we shouldn't be, a workaround could look like this.) diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh index 36f06c7..afd74c8 100755 --- a/t/t4019-diff-wserror.sh +++ b/t/t4019-diff-wserror.sh @@ -36,6 +36,7 @@ prepare_output () { git diff --color >output $grep_a "$blue_grep" output >error $grep_a -v "$blue_grep" output >normal + : } test_expect_success default ' -- ^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCHv4 08/15] t4026 (color): remove unneeded and unchained command 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren ` (6 preceding siblings ...) 2010-09-26 23:14 ` [PATCHv4 07/15] t4019 (diff-wserror): " Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-09-26 23:14 ` [PATCHv4 09/15] t5602 (clone-remote-exec): add missing && Elijah Newren ` (6 subsequent siblings) 14 siblings, 0 replies; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Ever since 8b12413 (color: allow multiple attributes 2010-02-27), diff.color.new has been unused in t4026, so also remove the final unsetting of that value to make the third to last test pass with appropriate '&&' chaining. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t4026-color.sh | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/t/t4026-color.sh b/t/t4026-color.sh index d5ccdd0..3726a0e 100755 --- a/t/t4026-color.sh +++ b/t/t4026-color.sh @@ -74,7 +74,6 @@ test_expect_success 'extra character after attribute' ' ' test_expect_success 'unknown color slots are ignored (diff)' ' - git config --unset diff.color.new git config color.diff.nosuchslotwilleverbedefined white && git diff --color ' -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCHv4 09/15] t5602 (clone-remote-exec): add missing && 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren ` (7 preceding siblings ...) 2010-09-26 23:14 ` [PATCHv4 08/15] t4026 (color): remove unneeded and unchained command Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-09-29 19:09 ` Junio C Hamano 2010-09-26 23:14 ` [PATCHv4 10/15] t6016 (rev-list-graph-simplify-history): " Elijah Newren ` (5 subsequent siblings) 14 siblings, 1 reply; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Also add a couple test_must_fail invocations where needed. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t5602-clone-remote-exec.sh | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/t/t5602-clone-remote-exec.sh b/t/t5602-clone-remote-exec.sh index deffdae..6aa6e0d 100755 --- a/t/t5602-clone-remote-exec.sh +++ b/t/t5602-clone-remote-exec.sh @@ -5,21 +5,21 @@ test_description=clone . ./test-lib.sh test_expect_success setup ' - echo "#!/bin/sh" > not_ssh - echo "echo \"\$*\" > not_ssh_output" >> not_ssh - echo "exit 1" >> not_ssh + echo "#!/bin/sh" > not_ssh && + echo "echo \"\$*\" > not_ssh_output" >> not_ssh && + echo "exit 1" >> not_ssh && chmod +x not_ssh ' test_expect_success 'clone calls git upload-pack unqualified with no -u option' ' - GIT_SSH=./not_ssh git clone localhost:/path/to/repo junk - echo "localhost git-upload-pack '\''/path/to/repo'\''" >expected + GIT_SSH=./not_ssh test_must_fail git clone localhost:/path/to/repo junk && + echo "localhost git-upload-pack '\''/path/to/repo'\''" >expected && test_cmp expected not_ssh_output ' test_expect_success 'clone calls specified git upload-pack with -u option' ' - GIT_SSH=./not_ssh git clone -u ./something/bin/git-upload-pack localhost:/path/to/repo junk - echo "localhost ./something/bin/git-upload-pack '\''/path/to/repo'\''" >expected + GIT_SSH=./not_ssh test_must_fail git clone -u ./something/bin/git-upload-pack localhost:/path/to/repo junk && + echo "localhost ./something/bin/git-upload-pack '\''/path/to/repo'\''" >expected && test_cmp expected not_ssh_output ' -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCHv4 09/15] t5602 (clone-remote-exec): add missing && 2010-09-26 23:14 ` [PATCHv4 09/15] t5602 (clone-remote-exec): add missing && Elijah Newren @ 2010-09-29 19:09 ` Junio C Hamano 2010-10-01 11:34 ` Jonathan Nieder 0 siblings, 1 reply; 51+ messages in thread From: Junio C Hamano @ 2010-09-29 19:09 UTC (permalink / raw) To: Elijah Newren; +Cc: git Elijah Newren <newren@gmail.com> writes: > Also add a couple test_must_fail invocations where needed. > > Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> > Signed-off-by: Elijah Newren <newren@gmail.com> > --- > t/t5602-clone-remote-exec.sh | 14 +++++++------- > 1 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/t/t5602-clone-remote-exec.sh b/t/t5602-clone-remote-exec.sh > index deffdae..6aa6e0d 100755 > --- a/t/t5602-clone-remote-exec.sh > +++ b/t/t5602-clone-remote-exec.sh > @@ -5,21 +5,21 @@ test_description=clone > . ./test-lib.sh > > test_expect_success setup ' > - echo "#!/bin/sh" > not_ssh > - echo "echo \"\$*\" > not_ssh_output" >> not_ssh > - echo "exit 1" >> not_ssh > + echo "#!/bin/sh" > not_ssh && > + echo "echo \"\$*\" > not_ssh_output" >> not_ssh && > + echo "exit 1" >> not_ssh && > chmod +x not_ssh > ' > > test_expect_success 'clone calls git upload-pack unqualified with no -u option' ' > - GIT_SSH=./not_ssh git clone localhost:/path/to/repo junk > - echo "localhost git-upload-pack '\''/path/to/repo'\''" >expected > + GIT_SSH=./not_ssh test_must_fail git clone localhost:/path/to/repo junk && I think this suffers from the same issue that have been fixed with 09b78bc (t7502-commit.sh: rearrange test to make more portable, 2008-07-22) and 2d60615 (tests: Avoid single-shot environment export for shell function invocation, 2009-01-26). > + echo "localhost git-upload-pack '\''/path/to/repo'\''" >expected && > test_cmp expected not_ssh_output > ' > > test_expect_success 'clone calls specified git upload-pack with -u option' ' > - GIT_SSH=./not_ssh git clone -u ./something/bin/git-upload-pack localhost:/path/to/repo junk > - echo "localhost ./something/bin/git-upload-pack '\''/path/to/repo'\''" >expected > + GIT_SSH=./not_ssh test_must_fail git clone -u ./something/bin/git-upload-pack localhost:/path/to/repo junk && So does this. > + echo "localhost ./something/bin/git-upload-pack '\''/path/to/repo'\''" >expected && > test_cmp expected not_ssh_output > ' > > -- > 1.7.3.95.g14291 ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 09/15] t5602 (clone-remote-exec): add missing && 2010-09-29 19:09 ` Junio C Hamano @ 2010-10-01 11:34 ` Jonathan Nieder 2010-10-03 3:08 ` Elijah Newren 0 siblings, 1 reply; 51+ messages in thread From: Jonathan Nieder @ 2010-10-01 11:34 UTC (permalink / raw) To: Junio C Hamano; +Cc: Elijah Newren, git Junio C Hamano wrote: > Elijah Newren <newren@gmail.com> writes: >> + GIT_SSH=./not_ssh test_must_fail git clone localhost:/path/to/repo junk && > > I think this suffers from the same issue that have been fixed with 09b78bc > (t7502-commit.sh: rearrange test to make more portable, 2008-07-22) and > 2d60615 (tests: Avoid single-shot environment export for shell function > invocation, 2009-01-26). Here's a patch for squashing. Thanks again. diff --git a/t/t5602-clone-remote-exec.sh b/t/t5602-clone-remote-exec.sh index 6aa6e0d..3f353d9 100755 --- a/t/t5602-clone-remote-exec.sh +++ b/t/t5602-clone-remote-exec.sh @@ -12,13 +12,21 @@ test_expect_success setup ' ' test_expect_success 'clone calls git upload-pack unqualified with no -u option' ' - GIT_SSH=./not_ssh test_must_fail git clone localhost:/path/to/repo junk && + ( + GIT_SSH=./not_ssh && + export GIT_SSH && + test_must_fail git clone localhost:/path/to/repo junk + ) && echo "localhost git-upload-pack '\''/path/to/repo'\''" >expected && test_cmp expected not_ssh_output ' test_expect_success 'clone calls specified git upload-pack with -u option' ' - GIT_SSH=./not_ssh test_must_fail git clone -u ./something/bin/git-upload-pack localhost:/path/to/repo junk && + ( + GIT_SSH=./not_ssh && + export GIT_SSH && + test_must_fail git clone -u ./something/bin/git-upload-pack localhost:/path/to/repo junk + ) && echo "localhost ./something/bin/git-upload-pack '\''/path/to/repo'\''" >expected && test_cmp expected not_ssh_output ' -- ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCHv4 09/15] t5602 (clone-remote-exec): add missing && 2010-10-01 11:34 ` Jonathan Nieder @ 2010-10-03 3:08 ` Elijah Newren 0 siblings, 0 replies; 51+ messages in thread From: Elijah Newren @ 2010-10-03 3:08 UTC (permalink / raw) To: Jonathan Nieder; +Cc: Junio C Hamano, git On Fri, Oct 1, 2010 at 5:34 AM, Jonathan Nieder <jrnieder@gmail.com> wrote: > Junio C Hamano wrote: >> Elijah Newren <newren@gmail.com> writes: > >>> + GIT_SSH=./not_ssh test_must_fail git clone localhost:/path/to/repo junk && >> >> I think this suffers from the same issue that have been fixed with 09b78bc >> (t7502-commit.sh: rearrange test to make more portable, 2008-07-22) and >> 2d60615 (tests: Avoid single-shot environment export for shell function >> invocation, 2009-01-26). > > Here's a patch for squashing. > > Thanks again. Thanks for all the reviews and help. Sorry I've been so slow to respond; it's been a busy week. ^ permalink raw reply [flat|nested] 51+ messages in thread
* [PATCHv4 10/15] t6016 (rev-list-graph-simplify-history): add missing && 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren ` (8 preceding siblings ...) 2010-09-26 23:14 ` [PATCHv4 09/15] t5602 (clone-remote-exec): add missing && Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-09-27 0:10 ` Jonathan Nieder 2010-09-26 23:14 ` [PATCHv4 11/15] t7001 (mv): " Elijah Newren ` (4 subsequent siblings) 14 siblings, 1 reply; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Also removed several repeated tag and branch deletions, since the tags and branches had already been deleted. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t6016-rev-list-graph-simplify-history.sh | 24 ++++++------------------ 1 files changed, 6 insertions(+), 18 deletions(-) diff --git a/t/t6016-rev-list-graph-simplify-history.sh b/t/t6016-rev-list-graph-simplify-history.sh index 27fd52b..e640c41 100755 --- a/t/t6016-rev-list-graph-simplify-history.sh +++ b/t/t6016-rev-list-graph-simplify-history.sh @@ -29,7 +29,7 @@ test_expect_success 'set up rev-list --graph test' ' # Octopus merge B and C into branch A git checkout A && git merge B C && - git tag A4 + git tag A4 && test_commit A5 bar.txt && @@ -39,7 +39,7 @@ test_expect_success 'set up rev-list --graph test' ' test_commit C4 bar.txt && git checkout A && git merge -s ours C && - git tag A6 + git tag A6 && test_commit A7 bar.txt && @@ -90,7 +90,7 @@ test_expect_success '--graph --all' ' # that undecorated merges are interesting, even with --simplify-by-decoration test_expect_success '--graph --simplify-by-decoration' ' rm -f expected && - git tag -d A4 + git tag -d A4 && echo "* $A7" >> expected && echo "* $A6" >> expected && echo "|\\ " >> expected && @@ -119,9 +119,9 @@ test_expect_success '--graph --simplify-by-decoration' ' # Get rid of all decorations on branch B, and graph with it simplified away test_expect_success '--graph --simplify-by-decoration prune branch B' ' rm -f expected && - git tag -d B2 - git tag -d B1 - git branch -d B + git tag -d B2 && + git tag -d B1 && + git branch -d B && echo "* $A7" >> expected && echo "* $A6" >> expected && echo "|\\ " >> expected && @@ -143,9 +143,6 @@ test_expect_success '--graph --simplify-by-decoration prune branch B' ' test_expect_success '--graph --full-history -- bar.txt' ' rm -f expected && - git tag -d B2 - git tag -d B1 - git branch -d B echo "* $A7" >> expected && echo "* $A6" >> expected && echo "|\\ " >> expected && @@ -163,9 +160,6 @@ test_expect_success '--graph --full-history -- bar.txt' ' test_expect_success '--graph --full-history --simplify-merges -- bar.txt' ' rm -f expected && - git tag -d B2 - git tag -d B1 - git branch -d B echo "* $A7" >> expected && echo "* $A6" >> expected && echo "|\\ " >> expected && @@ -181,9 +175,6 @@ test_expect_success '--graph --full-history --simplify-merges -- bar.txt' ' test_expect_success '--graph -- bar.txt' ' rm -f expected && - git tag -d B2 - git tag -d B1 - git branch -d B echo "* $A7" >> expected && echo "* $A5" >> expected && echo "* $A3" >> expected && @@ -196,9 +187,6 @@ test_expect_success '--graph -- bar.txt' ' test_expect_success '--graph --sparse -- bar.txt' ' rm -f expected && - git tag -d B2 - git tag -d B1 - git branch -d B echo "* $A7" >> expected && echo "* $A6" >> expected && echo "* $A5" >> expected && -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCHv4 10/15] t6016 (rev-list-graph-simplify-history): add missing && 2010-09-26 23:14 ` [PATCHv4 10/15] t6016 (rev-list-graph-simplify-history): " Elijah Newren @ 2010-09-27 0:10 ` Jonathan Nieder 0 siblings, 0 replies; 51+ messages in thread From: Jonathan Nieder @ 2010-09-27 0:10 UTC (permalink / raw) To: Elijah Newren; +Cc: git, gitster, Adam Simpkins (+cc: Adam Simpkins) Hi, Thanks for doing this tedious work. Elijah Newren wrote: > Also removed several repeated tag and branch deletions Nit: present tense > , since the tags and > branches had already been deleted. I suspect the repeated deletions were to allow skipping individual tests. Maybe something like the following on top of your patch would achieve that. The rest looks good to me, for what it's worth. diff --git a/t/t6016-rev-list-graph-simplify-history.sh b/t/t6016-rev-list-graph-simplify-history.sh index e640c41..5036940 100755 --- a/t/t6016-rev-list-graph-simplify-history.sh +++ b/t/t6016-rev-list-graph-simplify-history.sh @@ -116,12 +116,15 @@ test_expect_success '--graph --simplify-by-decoration' ' test_cmp expected actual ' -# Get rid of all decorations on branch B, and graph with it simplified away -test_expect_success '--graph --simplify-by-decoration prune branch B' ' - rm -f expected && +test_expect_success 'setup: get rid of decorations on branch B' ' git tag -d B2 && git tag -d B1 && - git branch -d B && + git branch -d B +' + +# Graph with branch B simplified away. +test_expect_success '--graph --simplify-by-decoration prune branch B' ' + rm -f expected && echo "* $A7" >> expected && echo "* $A6" >> expected && echo "|\\ " >> expected && -- ^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCHv4 11/15] t7001 (mv): add missing && 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren ` (9 preceding siblings ...) 2010-09-26 23:14 ` [PATCHv4 10/15] t6016 (rev-list-graph-simplify-history): " Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-09-26 23:14 ` [PATCHv4 12/15] t7601 (merge-pull-config): " Elijah Newren ` (3 subsequent siblings) 14 siblings, 0 replies; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Also, prefix an expected-to-fail git mv command with 'test_must_fail'. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t7001-mv.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh index 65a35d9..624e6d2 100755 --- a/t/t7001-mv.sh +++ b/t/t7001-mv.sh @@ -61,7 +61,7 @@ test_expect_success \ test_expect_success \ 'checking -f on untracked file with existing target' \ 'touch path0/untracked1 && - git mv -f untracked1 path0 + test_must_fail git mv -f untracked1 path0 && test ! -f .git/index.lock && test -f untracked1 && test -f path0/untracked1' -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCHv4 12/15] t7601 (merge-pull-config): add missing && 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren ` (10 preceding siblings ...) 2010-09-26 23:14 ` [PATCHv4 11/15] t7001 (mv): " Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-09-26 23:14 ` [PATCHv4 13/15] t7800 (difftool): " Elijah Newren ` (2 subsequent siblings) 14 siblings, 0 replies; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Also prefix several relevant git merge commands with 'test_must_fail' to keep the tests passing. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t7601-merge-pull-config.sh | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh index 7ba94ea..b44b293 100755 --- a/t/t7601-merge-pull-config.sh +++ b/t/t7601-merge-pull-config.sh @@ -114,13 +114,13 @@ test_expect_success 'setup conflicted merge' ' test_expect_success 'merge picks up the best result' ' git config --unset-all pull.twohead && git reset --hard c5 && - git merge -s resolve c6 + test_must_fail git merge -s resolve c6 && resolve_count=$(conflict_count) && git reset --hard c5 && - git merge -s recursive c6 + test_must_fail git merge -s recursive c6 && recursive_count=$(conflict_count) && git reset --hard c5 && - git merge -s recursive -s resolve c6 + test_must_fail git merge -s recursive -s resolve c6 && auto_count=$(conflict_count) && test $auto_count = $recursive_count && test $auto_count != $resolve_count @@ -129,13 +129,13 @@ test_expect_success 'merge picks up the best result' ' test_expect_success 'merge picks up the best result (from config)' ' git config pull.twohead "recursive resolve" && git reset --hard c5 && - git merge -s resolve c6 + test_must_fail git merge -s resolve c6 && resolve_count=$(conflict_count) && git reset --hard c5 && - git merge -s recursive c6 + test_must_fail git merge -s recursive c6 && recursive_count=$(conflict_count) && git reset --hard c5 && - git merge c6 + test_must_fail git merge c6 && auto_count=$(conflict_count) && test $auto_count = $recursive_count && test $auto_count != $resolve_count -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCHv4 13/15] t7800 (difftool): add missing && 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren ` (11 preceding siblings ...) 2010-09-26 23:14 ` [PATCHv4 12/15] t7601 (merge-pull-config): " Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-10-01 11:30 ` Jonathan Nieder 2010-09-26 23:14 ` [PATCHv4 14/15] Add missing &&'s throughout the testsuite Elijah Newren 2010-09-26 23:14 ` [PATCHv4 15/15] Replace "unset VAR" with "unset VAR;" in testsuite as per t/README Elijah Newren 14 siblings, 1 reply; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Also remove a call to 'git config --unset difftool.prompt', since that is already unset by restore_test_defaults. Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t7800-difftool.sh | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh index 58dc6f6..ffb1960 100755 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@ -98,7 +98,7 @@ test_expect_success PERL 'difftool --gui works without configured diff.guitool' # Specify the diff tool using $GIT_DIFF_TOOL test_expect_success PERL 'GIT_DIFF_TOOL variable' ' - git config --unset diff.tool + git config --unset diff.tool && GIT_DIFF_TOOL=test-tool && export GIT_DIFF_TOOL && @@ -166,7 +166,6 @@ test_expect_success PERL 'difftool.prompt config variable is false' ' # Test that we don't have to pass --no-prompt when mergetool.prompt is false test_expect_success PERL 'difftool merge.prompt = false' ' - git config --unset difftool.prompt git config mergetool.prompt false && diff=$(git difftool branch) && @@ -211,7 +210,7 @@ test_expect_success PERL 'difftool last flag wins' ' # git-difftool falls back to git-mergetool config variables # so test that behavior here test_expect_success PERL 'difftool + mergetool config variables' ' - remove_config_vars + remove_config_vars && git config merge.tool test-tool && git config mergetool.test-tool.cmd "cat \$LOCAL" && @@ -254,17 +253,17 @@ test_expect_success PERL 'difftool -x cat' ' ' test_expect_success PERL 'difftool --extcmd echo arg1' ' - diff=$(git difftool --no-prompt --extcmd sh\ -c\ \"echo\ \$1\" branch) + diff=$(git difftool --no-prompt --extcmd sh\ -c\ \"echo\ \$1\" branch) && test "$diff" = file ' test_expect_success PERL 'difftool --extcmd cat arg1' ' - diff=$(git difftool --no-prompt --extcmd sh\ -c\ \"cat\ \$1\" branch) + diff=$(git difftool --no-prompt --extcmd sh\ -c\ \"cat\ \$1\" branch) && test "$diff" = master ' test_expect_success PERL 'difftool --extcmd cat arg2' ' - diff=$(git difftool --no-prompt --extcmd sh\ -c\ \"cat\ \$2\" branch) + diff=$(git difftool --no-prompt --extcmd sh\ -c\ \"cat\ \$2\" branch) && test "$diff" = branch ' -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCHv4 13/15] t7800 (difftool): add missing && 2010-09-26 23:14 ` [PATCHv4 13/15] t7800 (difftool): " Elijah Newren @ 2010-10-01 11:30 ` Jonathan Nieder 0 siblings, 0 replies; 51+ messages in thread From: Jonathan Nieder @ 2010-10-01 11:30 UTC (permalink / raw) To: Elijah Newren; +Cc: git, gitster Elijah Newren wrote: > Also remove a call to 'git config --unset difftool.prompt', since that is > already unset by restore_test_defaults. Isn't the restore_test_defaults call at the end of the previous test? It might not be reached. How about this? diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh index c45abf3..4048d10 100755 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@ -166,6 +166,7 @@ test_expect_success PERL 'difftool.prompt config variable is false' ' # Test that we don't have to pass --no-prompt when mergetool.prompt is false test_expect_success PERL 'difftool merge.prompt = false' ' + test_might_fail git config --unset difftool.prompt && git config mergetool.prompt false && diff=$(git difftool branch) && -- ^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCHv4 14/15] Add missing &&'s throughout the testsuite 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren ` (12 preceding siblings ...) 2010-09-26 23:14 ` [PATCHv4 13/15] t7800 (difftool): " Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-09-29 19:37 ` Junio C Hamano ` (2 more replies) 2010-09-26 23:14 ` [PATCHv4 15/15] Replace "unset VAR" with "unset VAR;" in testsuite as per t/README Elijah Newren 14 siblings, 3 replies; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t0001-init.sh | 2 +- t/t0003-attributes.sh | 41 +++++++++++++-------------- t/t0020-crlf.sh | 2 +- t/t0024-crlf-archive.sh | 4 +- t/t0026-eol-config.sh | 2 +- t/t0050-filesystem.sh | 6 ++-- t/t1000-read-tree-m-3way.sh | 2 +- t/t1302-repo-version.sh | 2 +- t/t1401-symbolic-ref.sh | 2 +- t/t1402-check-ref-format.sh | 4 +- t/t1410-reflog.sh | 8 ++-- t/t1501-worktree.sh | 2 +- t/t1509-root-worktree.sh | 6 ++-- t/t2007-checkout-symlink.sh | 2 +- t/t2016-checkout-patch.sh | 2 +- t/t2050-git-dir-relative.sh | 4 +- t/t2103-update-index-ignore-missing.sh | 2 +- t/t2200-add-update.sh | 2 +- t/t3001-ls-files-others-exclude.sh | 2 +- t/t3050-subprojects-fetch.sh | 4 +- t/t3203-branch-output.sh | 6 ++-- t/t3307-notes-man.sh | 2 +- t/t3406-rebase-message.sh | 6 ++-- t/t3408-rebase-multi-line.sh | 2 +- t/t3504-cherry-pick-rerere.sh | 4 +- t/t3903-stash.sh | 4 +- t/t3904-stash-patch.sh | 2 +- t/t4021-format-patch-numbered.sh | 2 +- t/t4027-diff-submodule.sh | 2 +- t/t4103-apply-binary.sh | 8 ++-- t/t4104-apply-boundary.sh | 4 +- t/t4111-apply-subdir.sh | 4 +- t/t4119-apply-config.sh | 2 +- t/t4124-apply-ws-rule.sh | 4 +- t/t4127-apply-same-fn.sh | 18 ++++++------ t/t4130-apply-criss-cross-rename.sh | 2 +- t/t4133-apply-filenames.sh | 6 ++-- t/t4150-am.sh | 2 +- t/t5300-pack-object.sh | 4 +- t/t5301-sliding-window.sh | 2 +- t/t5302-pack-index.sh | 2 +- t/t5500-fetch-pack.sh | 2 +- t/t5502-quickfetch.sh | 2 +- t/t5503-tagfollow.sh | 4 +- t/t5510-fetch.sh | 2 +- t/t5516-fetch-push.sh | 20 ++++++------ t/t5517-push-mirror.sh | 10 +++--- t/t5519-push-alternates.sh | 2 +- t/t5531-deep-submodule-push.sh | 2 +- t/t5541-http-push.sh | 2 +- t/t5550-http-fetch.sh | 6 ++-- t/t5601-clone.sh | 6 ++-- t/t5701-clone-local.sh | 8 ++-- t/t5705-clone-2gb.sh | 2 +- t/t6009-rev-list-parent.sh | 2 +- t/t6010-merge-base.sh | 2 +- t/t6022-merge-rename.sh | 2 +- t/t6024-recursive-merge.sh | 2 +- t/t6030-bisect-porcelain.sh | 8 ++-- t/t6040-tracking-info.sh | 2 +- t/t7004-tag.sh | 14 ++++---- t/t7105-reset-patch.sh | 6 ++-- t/t7300-clean.sh | 6 ++-- t/t7501-commit.sh | 2 +- t/t7502-commit.sh | 2 +- t/t7506-status-submodule.sh | 2 +- t/t7600-merge.sh | 2 +- t/t7610-mergetool.sh | 2 +- t/t7700-repack.sh | 2 +- t/t8003-blame.sh | 6 ++-- t/t9122-git-svn-author.sh | 4 +- t/t9123-git-svn-rebuild-with-rewriteroot.sh | 2 +- t/t9134-git-svn-ignore-paths.sh | 6 ++-- t/t9137-git-svn-dcommit-clobber-series.sh | 2 +- t/t9138-git-svn-authors-prog.sh | 6 ++-- t/t9146-git-svn-empty-dirs.sh | 6 ++-- t/t9151-svn-mergeinfo.sh | 22 +++++++------- t/t9200-git-cvsexportcommit.sh | 4 +- t/t9401-git-cvsserver-crlf.sh | 2 +- t/t9600-cvsimport.sh | 2 +- 80 files changed, 187 insertions(+), 188 deletions(-) diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 7fe8883..9d4539f 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -289,7 +289,7 @@ test_expect_success 'init notices EEXIST (2)' ' rm -fr newdir && ( mkdir newdir && - >newdir/a + >newdir/a && test_must_fail git init newdir/a/b && test -f newdir/a ) diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index de38c7f..ddd1c23 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -19,24 +19,23 @@ attr_check () { test_expect_success 'setup' ' mkdir -p a/b/d a/c && - ( - echo "[attr]notest !test" - echo "f test=f" - echo "a/i test=a/i" - echo "onoff test -test" - echo "offon -test test" - echo "no notest" - ) >.gitattributes && - ( - echo "g test=a/g" && - echo "b/g test=a/b/g" - ) >a/.gitattributes && - ( - echo "h test=a/b/h" && - echo "d/* test=a/b/d/*" - echo "d/yes notest" - ) >a/b/.gitattributes - + cat <<EOF >.gitattributes && +[attr]notest !test +f test=f +a/i test=a/i +onoff test -test +offon -test test +no notest +EOF + cat <<EOF >a/.gitattributes && +g test=a/g +b/g test=a/b/g +EOF + cat <<EOF >a/b/.gitattributes +h test=a/b/h +d/* test=a/b/d/* +d/yes notest +EOF ' test_expect_success 'attribute test' ' @@ -73,7 +72,7 @@ offon: test: set no: test: unspecified a/b/d/no: test: a/b/d/* a/b/d/yes: test: unspecified -EOF +EOF && sed -e "s/:.*//" < expect | git check-attr --stdin test > actual && test_cmp expect actual @@ -96,7 +95,7 @@ test_expect_success 'setup bare' ' test_expect_success 'bare repository: check that .gitattribute is ignored' ' ( - echo "f test=f" + echo "f test=f" && echo "a/i test=a/i" ) >.gitattributes && attr_check f unspecified && @@ -110,7 +109,7 @@ test_expect_success 'bare repository: check that .gitattribute is ignored' ' test_expect_success 'bare repository: test info/attributes' ' ( - echo "f test=f" + echo "f test=f" && echo "a/i test=a/i" ) >info/attributes && attr_check f f && diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh index 234a94f..1a8f44c 100755 --- a/t/t0020-crlf.sh +++ b/t/t0020-crlf.sh @@ -439,7 +439,7 @@ test_expect_success 'checkout when deleting .gitattributes' ' git rm .gitattributes && echo "contentsQ" | q_to_cr > .file2 && git add .file2 && - git commit -m third + git commit -m third && git checkout master~1 && git checkout master && diff --git a/t/t0024-crlf-archive.sh b/t/t0024-crlf-archive.sh index c7d0324..ec6c1b3 100755 --- a/t/t0024-crlf-archive.sh +++ b/t/t0024-crlf-archive.sh @@ -7,7 +7,7 @@ UNZIP=${UNZIP:-unzip} test_expect_success setup ' - git config core.autocrlf true + git config core.autocrlf true && printf "CRLF line ending\r\nAnd another\r\n" > sample && git add sample && @@ -20,7 +20,7 @@ test_expect_success setup ' test_expect_success 'tar archive' ' git archive --format=tar HEAD | - ( mkdir untarred && cd untarred && "$TAR" -xf - ) + ( mkdir untarred && cd untarred && "$TAR" -xf - ) && test_cmp sample untarred/sample diff --git a/t/t0026-eol-config.sh b/t/t0026-eol-config.sh index f37ac8f..fe0164b 100755 --- a/t/t0026-eol-config.sh +++ b/t/t0026-eol-config.sh @@ -12,7 +12,7 @@ test_expect_success setup ' git config core.autocrlf false && - echo "one text" > .gitattributes + echo "one text" > .gitattributes && for w in Hello world how are you; do echo $w; done >one && for w in I am very very fine thank you; do echo $w; done >two && diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh index 41df6bc..64fa8b0 100755 --- a/t/t0050-filesystem.sh +++ b/t/t0050-filesystem.sh @@ -12,8 +12,8 @@ unibad= no_symlinks= test_expect_success 'see what we expect' ' - test_case=test_expect_success - test_unicode=test_expect_success + test_case=test_expect_success && + test_unicode=test_expect_success && mkdir junk && echo good >junk/CamelCase && echo bad >junk/camelcase && @@ -128,7 +128,7 @@ test_expect_success "setup unicode normalization tests" ' cd unicode && touch "$aumlcdiar" && git add "$aumlcdiar" && - git commit -m initial + git commit -m initial && git tag initial && git checkout -b topic && git mv $aumlcdiar tmp && diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh index 4f17172..ca8a409 100755 --- a/t/t1000-read-tree-m-3way.sh +++ b/t/t1000-read-tree-m-3way.sh @@ -309,7 +309,7 @@ test_expect_success \ test_expect_success \ '6 - must not exist in O && !A && !B case' " rm -f .git/index DD && - echo DD >DD + echo DD >DD && git update-index --add DD && test_must_fail git read-tree -m $tree_O $tree_A $tree_B " diff --git a/t/t1302-repo-version.sh b/t/t1302-repo-version.sh index a6bf1bf..0e47662 100755 --- a/t/t1302-repo-version.sh +++ b/t/t1302-repo-version.sh @@ -39,7 +39,7 @@ test_expect_success 'gitdir selection on unsupported repo' ' ( cd test2 && git config core.repositoryformatversion >../actual - ) + ) && test_cmp expect actual ' diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh index 7fa5f5b..2c96551 100755 --- a/t/t1401-symbolic-ref.sh +++ b/t/t1401-symbolic-ref.sh @@ -28,7 +28,7 @@ test_expect_success 'symbolic-ref refuses non-ref for HEAD' ' reset_to_sane test_expect_success 'symbolic-ref refuses bare sha1' ' - echo content >file && git add file && git commit -m one + echo content >file && git add file && git commit -m one && test_must_fail git symbolic-ref HEAD `git rev-parse HEAD` ' reset_to_sane diff --git a/t/t1402-check-ref-format.sh b/t/t1402-check-ref-format.sh index 782e75d..1b0f82f 100755 --- a/t/t1402-check-ref-format.sh +++ b/t/t1402-check-ref-format.sh @@ -32,7 +32,7 @@ test_expect_success "check-ref-format --branch @{-1}" ' T=$(git write-tree) && sha1=$(echo A | git commit-tree $T) && git update-ref refs/heads/master $sha1 && - git update-ref refs/remotes/origin/master $sha1 + git update-ref refs/remotes/origin/master $sha1 && git checkout master && git checkout origin/master && git checkout master && @@ -47,7 +47,7 @@ test_expect_success 'check-ref-format --branch from subdir' ' T=$(git write-tree) && sha1=$(echo A | git commit-tree $T) && git update-ref refs/heads/master $sha1 && - git update-ref refs/remotes/origin/master $sha1 + git update-ref refs/remotes/origin/master $sha1 && git checkout master && git checkout origin/master && git checkout master && diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index 25046c4..252fc82 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -186,8 +186,8 @@ test_expect_success 'delete' ' test_tick && git commit -m tiger C && - HEAD_entry_count=$(git reflog | wc -l) - master_entry_count=$(git reflog show master | wc -l) + HEAD_entry_count=$(git reflog | wc -l) && + master_entry_count=$(git reflog show master | wc -l) && test $HEAD_entry_count = 5 && test $master_entry_count = 5 && @@ -199,13 +199,13 @@ test_expect_success 'delete' ' test $HEAD_entry_count = $(git reflog | wc -l) && ! grep ox < output && - master_entry_count=$(wc -l < output) + master_entry_count=$(wc -l < output) && git reflog delete HEAD@{1} && test $(($HEAD_entry_count -1)) = $(git reflog | wc -l) && test $master_entry_count = $(git reflog show master | wc -l) && - HEAD_entry_count=$(git reflog | wc -l) + HEAD_entry_count=$(git reflog | wc -l) && git reflog delete master@{07.04.2005.15:15:00.-0700} && git reflog show master > output && diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh index 2c8f01f..8af9ca4 100755 --- a/t/t1501-worktree.sh +++ b/t/t1501-worktree.sh @@ -335,7 +335,7 @@ test_expect_success 'absolute pathspec should fail gracefully' ' ' test_expect_success 'make_relative_path handles double slashes in GIT_DIR' ' - >dummy_file + >dummy_file && echo git --git-dir="$(pwd)//repo.git" --work-tree="$(pwd)" add dummy_file && git --git-dir="$(pwd)//repo.git" --work-tree="$(pwd)" add dummy_file ' diff --git a/t/t1509-root-worktree.sh b/t/t1509-root-worktree.sh index 7f60fd0..e3391b7 100755 --- a/t/t1509-root-worktree.sh +++ b/t/t1509-root-worktree.sh @@ -209,7 +209,7 @@ unset GIT_WORK_TREE test_expect_success 'go to /' 'cd /' test_expect_success 'setup' ' - rm -rf /.git + rm -rf /.git && echo "Initialized empty Git repository in /.git/" > expected && git init > result && test_cmp expected result @@ -232,8 +232,8 @@ say "auto bare gitdir" # DESTROYYYYY!!!!! test_expect_success 'setup' ' - rm -rf /refs /objects /info /hooks - rm /* + rm -rf /refs /objects /info /hooks && + rm /* && cd / && echo "Initialized empty Git repository in /" > expected && git init --bare > result && diff --git a/t/t2007-checkout-symlink.sh b/t/t2007-checkout-symlink.sh index a74ee22..e6f59f1 100755 --- a/t/t2007-checkout-symlink.sh +++ b/t/t2007-checkout-symlink.sh @@ -17,7 +17,7 @@ test_expect_success SYMLINKS setup ' git branch side && echo goodbye >nitfol && - git add nitfol + git add nitfol && test_tick && git commit -m "master adds file nitfol" && diff --git a/t/t2016-checkout-patch.sh b/t/t2016-checkout-patch.sh index a463b13..9cd0ac4 100755 --- a/t/t2016-checkout-patch.sh +++ b/t/t2016-checkout-patch.sh @@ -32,7 +32,7 @@ test_expect_success PERL 'git checkout -p' ' ' test_expect_success PERL 'git checkout -p with staged changes' ' - set_state dir/foo work index + set_state dir/foo work index && (echo n; echo y) | git checkout -p && verify_saved_state bar && verify_state dir/foo index index diff --git a/t/t2050-git-dir-relative.sh b/t/t2050-git-dir-relative.sh index b7131d8..21f4659 100755 --- a/t/t2050-git-dir-relative.sh +++ b/t/t2050-git-dir-relative.sh @@ -26,7 +26,7 @@ chmod +x .git/hooks/post-commit' test_expect_success 'post-commit hook used ordinarily' ' echo initial >top && -git add top +git add top && git commit -m initial && test -r "${COMMIT_FILE}" ' @@ -45,7 +45,7 @@ test -r "${COMMIT_FILE}" rm -rf "${COMMIT_FILE}" test_expect_success 'post-commit-hook from sub dir' ' -echo changed again >top +echo changed again >top && cd subdir && git --git-dir .git --work-tree .. add ../top && git --git-dir .git --work-tree .. commit -m subcommit && diff --git a/t/t2103-update-index-ignore-missing.sh b/t/t2103-update-index-ignore-missing.sh index 332694e..0114f05 100755 --- a/t/t2103-update-index-ignore-missing.sh +++ b/t/t2103-update-index-ignore-missing.sh @@ -32,7 +32,7 @@ test_expect_success basics ' test_create_repo xyzzy && cd xyzzy && >file && - git add file + git add file && git commit -m "sub initial" ) && git add xyzzy && diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh index 2ad2819..0692427 100755 --- a/t/t2200-add-update.sh +++ b/t/t2200-add-update.sh @@ -25,7 +25,7 @@ test_expect_success setup ' echo initial >dir1/sub2 && echo initial >dir2/sub3 && git add check dir1 dir2 top foo && - test_tick + test_tick && git commit -m initial && echo changed >check && diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh index 6d2f2b6..c8fe978 100755 --- a/t/t3001-ls-files-others-exclude.sh +++ b/t/t3001-ls-files-others-exclude.sh @@ -156,7 +156,7 @@ test_expect_success 'trailing slash in exclude allows directory match (2)' ' test_expect_success 'trailing slash in exclude forces directory match (1)' ' - >two + >two && git ls-files --others --exclude=two/ >output && grep "^two" output diff --git a/t/t3050-subprojects-fetch.sh b/t/t3050-subprojects-fetch.sh index 4261e96..2f5f41a 100755 --- a/t/t3050-subprojects-fetch.sh +++ b/t/t3050-subprojects-fetch.sh @@ -10,10 +10,10 @@ test_expect_success setup ' cd sub && git init && >subfile && - git add subfile + git add subfile && git commit -m "subproject commit #1" ) && - >mainfile + >mainfile && git add sub mainfile && test_tick && git commit -m "superproject commit #1" diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh index 809d1c4..6028748 100755 --- a/t/t3203-branch-output.sh +++ b/t/t3203-branch-output.sh @@ -12,13 +12,13 @@ test_expect_success 'make commits' ' ' test_expect_success 'make branches' ' - git branch branch-one + git branch branch-one && git branch branch-two HEAD^ ' test_expect_success 'make remote branches' ' - git update-ref refs/remotes/origin/branch-one branch-one - git update-ref refs/remotes/origin/branch-two branch-two + git update-ref refs/remotes/origin/branch-one branch-one && + git update-ref refs/remotes/origin/branch-two branch-two && git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/branch-one ' diff --git a/t/t3307-notes-man.sh b/t/t3307-notes-man.sh index 3269f2e..2ea3be6 100755 --- a/t/t3307-notes-man.sh +++ b/t/t3307-notes-man.sh @@ -26,7 +26,7 @@ test_expect_success 'example 1: notes to add an Acked-by line' ' ' test_expect_success 'example 2: binary notes' ' - cp "$TEST_DIRECTORY"/test4012.png . + cp "$TEST_DIRECTORY"/test4012.png . && git checkout B && blob=$(git hash-object -w test4012.png) && git notes --ref=logo add -C "$blob" && diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh index 85fc7c4..fe5f936 100755 --- a/t/t3406-rebase-message.sh +++ b/t/t3406-rebase-message.sh @@ -43,20 +43,20 @@ test_expect_success 'rebase -m' ' ' test_expect_success 'rebase --stat' ' - git reset --hard start + git reset --hard start && git rebase --stat master >diffstat.txt && grep "^ fileX | *1 +$" diffstat.txt ' test_expect_success 'rebase w/config rebase.stat' ' - git reset --hard start + git reset --hard start && git config rebase.stat true && git rebase master >diffstat.txt && grep "^ fileX | *1 +$" diffstat.txt ' test_expect_success 'rebase -n overrides config rebase.stat config' ' - git reset --hard start + git reset --hard start && git config rebase.stat true && git rebase -n master >diffstat.txt && ! grep "^ fileX | *1 +$" diffstat.txt diff --git a/t/t3408-rebase-multi-line.sh b/t/t3408-rebase-multi-line.sh index 2062b85..6b84e60 100755 --- a/t/t3408-rebase-multi-line.sh +++ b/t/t3408-rebase-multi-line.sh @@ -16,7 +16,7 @@ test_expect_success setup ' git commit -a -m "A sample commit log message that has a long summary that spills over multiple lines. -But otherwise with a sane description." +But otherwise with a sane description." && git branch side && diff --git a/t/t3504-cherry-pick-rerere.sh b/t/t3504-cherry-pick-rerere.sh index f7b3518..e6a6481 100755 --- a/t/t3504-cherry-pick-rerere.sh +++ b/t/t3504-cherry-pick-rerere.sh @@ -23,7 +23,7 @@ test_expect_success 'conflicting merge' ' test_expect_success 'fixup' ' echo foo-dev >foo && git add foo && test_tick && git commit -q -m 4 && - git reset --hard HEAD^ + git reset --hard HEAD^ && echo foo-dev >expect ' @@ -33,7 +33,7 @@ test_expect_success 'cherry-pick conflict' ' ' test_expect_success 'reconfigure' ' - git config rerere.enabled false + git config rerere.enabled false && git reset --hard ' diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index a283dca..d42b8ab 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -157,7 +157,7 @@ EOF test_expect_success 'stash branch' ' echo foo > file && - git commit file -m first + git commit file -m first && echo bar > file && echo bar2 > file2 && git add file2 && @@ -268,7 +268,7 @@ test_expect_success 'stash rm and ignore (stage .gitignore)' ' git add .gitignore && git stash save "rm and ignore (stage .gitignore)" && test bar = "$(cat file)" && - ! test -r .gitignore + ! test -r .gitignore && git stash apply && ! test -r file && test file = "$(cat .gitignore)" diff --git a/t/t3904-stash-patch.sh b/t/t3904-stash-patch.sh index d1819ca..1e7193a 100755 --- a/t/t3904-stash-patch.sh +++ b/t/t3904-stash-patch.sh @@ -20,7 +20,7 @@ test_expect_success PERL 'setup' ' # note: bar sorts before dir, so the first 'n' is always to skip 'bar' test_expect_success PERL 'saying "n" does nothing' ' - set_state dir/foo work index + set_state dir/foo work index && (echo n; echo n) | test_must_fail git stash save -p && verify_state dir/foo work index && verify_saved_state bar diff --git a/t/t4021-format-patch-numbered.sh b/t/t4021-format-patch-numbered.sh index 709b323..886494b 100755 --- a/t/t4021-format-patch-numbered.sh +++ b/t/t4021-format-patch-numbered.sh @@ -95,7 +95,7 @@ test_expect_success 'format.numbered && --keep-subject' ' test_expect_success 'format.numbered = auto' ' - git config format.numbered auto + git config format.numbered auto && git format-patch --stdout HEAD~2 > patch5 && test_numbered patch5 diff --git a/t/t4027-diff-submodule.sh b/t/t4027-diff-submodule.sh index d99814a..e62bf2c 100755 --- a/t/t4027-diff-submodule.sh +++ b/t/t4027-diff-submodule.sh @@ -316,7 +316,7 @@ test_expect_success 'git diff (empty submodule dir)' ' test_expect_success 'conflicted submodule setup' ' # 39 efs - c=fffffffffffffffffffffffffffffffffffffff + c=fffffffffffffffffffffffffffffffffffffff && ( echo "000000 $_z40 0 sub" echo "160000 1$c 1 sub" diff --git a/t/t4103-apply-binary.sh b/t/t4103-apply-binary.sh index 9692f16..954118c 100755 --- a/t/t4103-apply-binary.sh +++ b/t/t4103-apply-binary.sh @@ -41,11 +41,11 @@ test_expect_success 'setup' " " test_expect_success 'stat binary diff -- should not fail.' \ - 'git checkout master + 'git checkout master && git apply --stat --summary B.diff' test_expect_success 'stat binary diff (copy) -- should not fail.' \ - 'git checkout master + 'git checkout master && git apply --stat --summary C.diff' test_expect_success 'check binary diff -- should fail.' \ @@ -69,11 +69,11 @@ test_expect_success \ ' test_expect_success 'check binary diff with replacement.' \ - 'git checkout master + 'git checkout master && git apply --check --allow-binary-replacement BF.diff' test_expect_success 'check binary diff with replacement (copy).' \ - 'git checkout master + 'git checkout master && git apply --check --allow-binary-replacement CF.diff' # Now we start applying them. diff --git a/t/t4104-apply-boundary.sh b/t/t4104-apply-boundary.sh index c617c2a..8e97410 100755 --- a/t/t4104-apply-boundary.sh +++ b/t/t4104-apply-boundary.sh @@ -51,7 +51,7 @@ test_expect_success setup ' echo $i done >victim && 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 && : add to the tail @@ -78,7 +78,7 @@ test_expect_success setup ' echo $i done >victim && 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 && : done diff --git a/t/t4111-apply-subdir.sh b/t/t4111-apply-subdir.sh index a52d94a..7c39843 100755 --- a/t/t4111-apply-subdir.sh +++ b/t/t4111-apply-subdir.sh @@ -89,7 +89,7 @@ test_expect_success 'apply --index from subdir of toplevel' ' test_expect_success 'apply from .git dir' ' cp postimage expected && cp preimage .git/file && - cp preimage .git/objects/file + cp preimage .git/objects/file && ( cd .git && git apply "$patch" @@ -100,7 +100,7 @@ test_expect_success 'apply from .git dir' ' test_expect_success 'apply from subdir of .git dir' ' cp postimage expected && cp preimage .git/file && - cp preimage .git/objects/file + cp preimage .git/objects/file && ( cd .git/objects && git apply "$patch" diff --git a/t/t4119-apply-config.sh b/t/t4119-apply-config.sh index 3c73a78..3d0384d 100755 --- a/t/t4119-apply-config.sh +++ b/t/t4119-apply-config.sh @@ -73,7 +73,7 @@ D=`pwd` test_expect_success 'apply --whitespace=strip in subdir' ' cd "$D" && - git config --unset-all apply.whitespace + git config --unset-all apply.whitespace && rm -f sub/file1 && cp saved sub/file1 && git update-index --refresh && diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh index 8a676a5..ccd694a 100755 --- a/t/t4124-apply-ws-rule.sh +++ b/t/t4124-apply-ws-rule.sh @@ -419,7 +419,7 @@ test_expect_success 'same, but with CR-LF line endings && cr-at-eol set' ' printf "b\r\n" >>one && printf "c\r\n" >>one && cp one save-one && - printf " \r\n" >>one + printf " \r\n" >>one && git add one && printf "d\r\n" >>one && cp one expect && @@ -436,7 +436,7 @@ test_expect_success 'same, but with CR-LF line endings && cr-at-eol unset' ' printf "b\r\n" >>one && printf "c\r\n" >>one && cp one save-one && - printf " \r\n" >>one + printf " \r\n" >>one && git add one && cp one expect && printf "d\r\n" >>one && diff --git a/t/t4127-apply-same-fn.sh b/t/t4127-apply-same-fn.sh index 77200c0..972946c 100755 --- a/t/t4127-apply-same-fn.sh +++ b/t/t4127-apply-same-fn.sh @@ -31,7 +31,7 @@ test_expect_success 'apply same filename with independent changes' ' ' test_expect_success 'apply same filename with overlapping changes' ' - git reset --hard + git reset --hard && modify "s/^d/z/" same_fn && git diff > patch0 && git add same_fn && @@ -44,8 +44,8 @@ test_expect_success 'apply same filename with overlapping changes' ' ' test_expect_success 'apply same new filename after rename' ' - git reset --hard - git mv same_fn new_fn + git reset --hard && + git mv same_fn new_fn && modify "s/^d/z/" new_fn && git add new_fn && git diff -M --cached > patch1 && @@ -58,12 +58,12 @@ test_expect_success 'apply same new filename after rename' ' ' test_expect_success 'apply same old filename after rename -- should fail.' ' - git reset --hard - git mv same_fn new_fn + git reset --hard && + git mv same_fn new_fn && modify "s/^d/z/" new_fn && git add new_fn && git diff -M --cached > patch1 && - git mv new_fn same_fn + git mv new_fn same_fn && modify "s/^e/y/" same_fn && git diff >> patch1 && git reset --hard && @@ -71,13 +71,13 @@ test_expect_success 'apply same old filename after rename -- should fail.' ' ' test_expect_success 'apply A->B (rename), C->A (rename), A->A -- should pass.' ' - git reset --hard - git mv same_fn new_fn + git reset --hard && + git mv same_fn new_fn && modify "s/^d/z/" new_fn && git add new_fn && git diff -M --cached > patch1 && git commit -m "a rename" && - git mv other_fn same_fn + git mv other_fn same_fn && modify "s/^e/y/" same_fn && git add same_fn && git diff -M --cached >> patch1 && diff --git a/t/t4130-apply-criss-cross-rename.sh b/t/t4130-apply-criss-cross-rename.sh index 7cfa2d6..d173acd 100755 --- a/t/t4130-apply-criss-cross-rename.sh +++ b/t/t4130-apply-criss-cross-rename.sh @@ -44,7 +44,7 @@ test_expect_success 'criss-cross rename' ' git reset --hard && mv file1 tmp && mv file2 file1 && - mv file3 file2 + mv file3 file2 && mv tmp file3 && cp file1 file1-swapped && cp file2 file2-swapped && diff --git a/t/t4133-apply-filenames.sh b/t/t4133-apply-filenames.sh index 3421807..88b35ae 100755 --- a/t/t4133-apply-filenames.sh +++ b/t/t4133-apply-filenames.sh @@ -29,9 +29,9 @@ EOF ' test_expect_success 'apply diff with inconsistent filenames in headers' ' - test_must_fail git apply bad1.patch 2>err - grep "inconsistent new filename" err - test_must_fail git apply bad2.patch 2>err + test_must_fail git apply bad1.patch 2>err && + grep "inconsistent new filename" err && + test_must_fail git apply bad2.patch 2>err && grep "inconsistent old filename" err ' diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 1c3d8ed..850fc96 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -219,7 +219,7 @@ test_expect_success 'am stays in branch' ' test_expect_success 'am --signoff does not add Signed-off-by: line if already there' ' git format-patch --stdout HEAD^ >patch3 && - sed -e "/^Subject/ s,\[PATCH,Re: Re: Re: & 1/5 v2," patch3 >patch4 + sed -e "/^Subject/ s,\[PATCH,Re: Re: Re: & 1/5 v2," patch3 >patch4 && rm -fr .git/rebase-apply && git reset --hard && git checkout HEAD^ && diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index bbb9c12..eac1e13 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -12,7 +12,7 @@ TRASH=`pwd` test_expect_success \ 'setup' \ - 'rm -f .git/index* + 'rm -f .git/index* && perl -e "print \"a\" x 4096;" > a && perl -e "print \"b\" x 4096;" > b && perl -e "print \"c\" x 4096;" > c && @@ -187,7 +187,7 @@ test_expect_success 'survive missing objects/pack directory' ' mkdir missing-pack && cd missing-pack && git init && - GOP=.git/objects/pack + GOP=.git/objects/pack && rm -fr $GOP && git index-pack --stdin --keep=test <../test-3-${packname_3}.pack && test -f $GOP/pack-${packname_3}.pack && diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh index 0a24e61..bcec3e9 100755 --- a/t/t5301-sliding-window.sh +++ b/t/t5301-sliding-window.sh @@ -8,7 +8,7 @@ test_description='mmap sliding window tests' test_expect_success \ 'setup' \ - 'rm -f .git/index* + 'rm -f .git/index* && for i in a b c do echo $i >$i && diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh index fb3a270..b34ea93 100755 --- a/t/t5302-pack-index.sh +++ b/t/t5302-pack-index.sh @@ -8,7 +8,7 @@ test_description='pack index with 64-bit offsets and object CRC' test_expect_success \ 'setup' \ - 'rm -rf .git + 'rm -rf .git && git init && git config pack.threads 1 && i=1 && diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 18376d6..bafcca7 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -91,7 +91,7 @@ test_expect_success 'setup' ' prev=$cur && cur=$(($cur+1)) done && - add B1 $A1 + add B1 $A1 && echo $ATIP > .git/refs/heads/A && echo $BTIP > .git/refs/heads/B && git symbolic-ref HEAD refs/heads/B diff --git a/t/t5502-quickfetch.sh b/t/t5502-quickfetch.sh index 1037a72..7a46cbd 100755 --- a/t/t5502-quickfetch.sh +++ b/t/t5502-quickfetch.sh @@ -57,7 +57,7 @@ test_expect_success 'copy commit and tree but not blob by hand' ' cd cloned && git count-objects | sed -e "s/ *objects,.*//" ) ) && - test $cnt -eq 6 + test $cnt -eq 6 && blob=$(git rev-parse HEAD:file | sed -e "s|..|&/|") && test -f "cloned/.git/objects/$blob" && diff --git a/t/t5503-tagfollow.sh b/t/t5503-tagfollow.sh index 8a298a6..e1c3efe 100755 --- a/t/t5503-tagfollow.sh +++ b/t/t5503-tagfollow.sh @@ -149,8 +149,8 @@ EOF ' test_expect_success NOT_MINGW 'new clone fetch master and tags' ' - git branch -D cat - rm -f $U + git branch -D cat && + rm -f $U && ( mkdir clone2 && cd clone2 && diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 9a88475..7e433b1 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -119,7 +119,7 @@ test_expect_success 'fetch must not resolve short tag name' ' test_expect_success 'fetch must not resolve short remote name' ' cd "$D" && - git update-ref refs/remotes/six/HEAD HEAD + git update-ref refs/remotes/six/HEAD HEAD && mkdir six && cd six && diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index b11da79..b30ec18 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -49,7 +49,7 @@ check_push_result () { ( cd testrepo && it="$1" && - shift + shift && for ref in "$@" do r=$(git show-ref -s --verify refs/$ref) && @@ -542,7 +542,7 @@ test_expect_success 'push does not update local refs on failure' ' chmod +x testrepo/.git/hooks/pre-receive && ( cd child && - git pull .. master + git pull .. master && test_must_fail git push && test $(git rev-parse master) != \ $(git rev-parse remotes/origin/master) @@ -586,7 +586,7 @@ test_expect_success 'push --delete refuses src:dest refspecs' ' ' test_expect_success 'warn on push to HEAD of non-bare repository' ' - mk_test heads/master + mk_test heads/master && ( cd testrepo && git checkout master && @@ -597,7 +597,7 @@ test_expect_success 'warn on push to HEAD of non-bare repository' ' ' test_expect_success 'deny push to HEAD of non-bare repository' ' - mk_test heads/master + mk_test heads/master && ( cd testrepo && git checkout master && @@ -607,7 +607,7 @@ test_expect_success 'deny push to HEAD of non-bare repository' ' ' test_expect_success 'allow push to HEAD of bare repository (bare)' ' - mk_test heads/master + mk_test heads/master && ( cd testrepo && git checkout master && @@ -619,7 +619,7 @@ test_expect_success 'allow push to HEAD of bare repository (bare)' ' ' test_expect_success 'allow push to HEAD of non-bare repository (config)' ' - mk_test heads/master + mk_test heads/master && ( cd testrepo && git checkout master && @@ -690,7 +690,7 @@ test_expect_success 'push into aliased refs (consistent)' ' ( cd child1 && git branch foo && - git symbolic-ref refs/heads/bar refs/heads/foo + git symbolic-ref refs/heads/bar refs/heads/foo && git config receive.denyCurrentBranch false ) && ( @@ -712,7 +712,7 @@ test_expect_success 'push into aliased refs (inconsistent)' ' ( cd child1 && git branch foo && - git symbolic-ref refs/heads/bar refs/heads/foo + git symbolic-ref refs/heads/bar refs/heads/foo && git config receive.denyCurrentBranch false ) && ( @@ -757,7 +757,7 @@ test_expect_success 'push --porcelain rejected' ' mk_empty && git push testrepo refs/heads/master:refs/remotes/origin/master && (cd testrepo && - git reset --hard origin/master^ + git reset --hard origin/master^ && git config receive.denyCurrentBranch true) && echo >.git/foo "To testrepo" && @@ -771,7 +771,7 @@ test_expect_success 'push --porcelain --dry-run rejected' ' mk_empty && git push testrepo refs/heads/master:refs/remotes/origin/master && (cd testrepo && - git reset --hard origin/master + git reset --hard origin/master && git config receive.denyCurrentBranch true) && echo >.git/foo "To testrepo" && diff --git a/t/t5517-push-mirror.sh b/t/t5517-push-mirror.sh index e2ad260..d13606b 100755 --- a/t/t5517-push-mirror.sh +++ b/t/t5517-push-mirror.sh @@ -71,7 +71,7 @@ test_expect_success 'push mirror force updates existing branches' ' git push --mirror up && echo two >foo && git add foo && git commit -m two && git push --mirror up && - git reset --hard HEAD^ + git reset --hard HEAD^ && git push --mirror up ) && master_master=$(cd master && git show-ref -s --verify refs/heads/master) && @@ -88,7 +88,7 @@ test_expect_success 'push mirror removes branches' ' echo one >foo && git add foo && git commit -m one && git branch remove master && git push --mirror up && - git branch -D remove + git branch -D remove && git push --mirror up ) && ( @@ -170,7 +170,7 @@ test_expect_success 'push mirror force updates existing tags' ' echo two >foo && git add foo && git commit -m two && git tag -f tmaster master && git push --mirror up && - git reset --hard HEAD^ + git reset --hard HEAD^ && git tag -f tmaster master && git push --mirror up ) && @@ -188,7 +188,7 @@ test_expect_success 'push mirror removes tags' ' echo one >foo && git add foo && git commit -m one && git tag -f tremove master && git push --mirror up && - git tag -d tremove + git tag -d tremove && git push --mirror up ) && ( @@ -235,7 +235,7 @@ test_expect_success 'remote.foo.mirror adds and removes branches' ' git branch keep master && git branch remove master && git push up && - git branch -D remove + git branch -D remove && git push up ) && ( diff --git a/t/t5519-push-alternates.sh b/t/t5519-push-alternates.sh index 96be523..c00c9b0 100755 --- a/t/t5519-push-alternates.sh +++ b/t/t5519-push-alternates.sh @@ -123,7 +123,7 @@ test_expect_success 'bob works and pushes again' ' ( cd alice-pub && git cat-file commit master >../bob-work/commit - ) + ) && ( # This time Bob does not pull from Alice, and # the master branch at her public repository points diff --git a/t/t5531-deep-submodule-push.sh b/t/t5531-deep-submodule-push.sh index 65d8d47..faa2e96 100755 --- a/t/t5531-deep-submodule-push.sh +++ b/t/t5531-deep-submodule-push.sh @@ -6,7 +6,7 @@ test_description='unpack-objects' test_expect_success setup ' mkdir pub.git && - GIT_DIR=pub.git git init --bare + GIT_DIR=pub.git git init --bare && GIT_DIR=pub.git git config receive.fsckobjects true && mkdir work && ( diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh index b0c2a2c..9b30cec 100755 --- a/t/t5541-http-push.sh +++ b/t/t5541-http-push.sh @@ -121,7 +121,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' ' # 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. - git push origin master:retsam + git push origin master:retsam && echo "change changed" > path2 && git commit -a -m path2 --amend && diff --git a/t/t5550-http-fetch.sh b/t/t5550-http-fetch.sh index 2fb48d0..dc0021b 100755 --- a/t/t5550-http-fetch.sh +++ b/t/t5550-http-fetch.sh @@ -37,7 +37,7 @@ test_expect_success 'clone http repository' ' test_expect_success 'fetch changes via http' ' echo content >>file && git commit -a -m two && - git push public + git push public && (cd clone && git pull) && test_cmp file clone/file ' @@ -93,8 +93,8 @@ test_expect_success 'fetch notices corrupt idx' ' ' test_expect_success 'did not use upload-pack service' ' - grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act - : >exp + grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act && + >exp && test_cmp exp act ' diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 987e0c8..a308d97 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -9,9 +9,9 @@ test_expect_success setup ' rm -fr .git && test_create_repo src && ( - cd src - >file - git add file + cd src && + >file && + git add file && git commit -m initial ) diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh index 8b4c356..cfed680 100755 --- a/t/t5701-clone-local.sh +++ b/t/t5701-clone-local.sh @@ -10,11 +10,11 @@ test_expect_success 'preparing origin repository' ' git clone --bare . a.git && git clone --bare . x && test "$(GIT_CONFIG=a.git/config git config --bool core.bare)" = true && - test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true + test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true && git bundle create b1.bundle --all && git bundle create b2.bundle master && mkdir dir && - cp b1.bundle dir/b3 + cp b1.bundle dir/b3 && cp b1.bundle b4 ' @@ -112,7 +112,7 @@ test_expect_success 'bundle clone with nonexistent HEAD' ' cd "$D" && git clone b2.bundle b2 && cd b2 && - git fetch + git fetch && test ! -e .git/refs/heads/master ' @@ -124,7 +124,7 @@ test_expect_success 'clone empty repository' ' git config receive.denyCurrentBranch warn) && git clone empty empty-clone && test_tick && - (cd empty-clone + (cd empty-clone && echo "content" >> foo && git add foo && git commit -m "Initial commit" && diff --git a/t/t5705-clone-2gb.sh b/t/t5705-clone-2gb.sh index e9783c3..dc42932 100755 --- a/t/t5705-clone-2gb.sh +++ b/t/t5705-clone-2gb.sh @@ -23,7 +23,7 @@ test_expect_success CLONE_2GB 'setup' ' printf "blob\nmark :$i\ndata $blobsize\n" && #test-genrandom $i $blobsize && printf "%-${blobsize}s" $i && - echo "M 100644 :$i $i" >> commit + echo "M 100644 :$i $i" >> commit && i=$(($i+1)) || echo $? > exit-status done && diff --git a/t/t6009-rev-list-parent.sh b/t/t6009-rev-list-parent.sh index c8a96a9..52f7b27 100755 --- a/t/t6009-rev-list-parent.sh +++ b/t/t6009-rev-list-parent.sh @@ -18,7 +18,7 @@ test_expect_success setup ' commit one && - test_tick=$(($test_tick - 2400)) + test_tick=$(($test_tick - 2400)) && commit two && commit three && diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh index 62197a3..082032e 100755 --- a/t/t6010-merge-base.sh +++ b/t/t6010-merge-base.sh @@ -131,7 +131,7 @@ test_expect_success 'unsynchronized clocks' ' R2=$(doit 3 R2 $R1) && PL=$(doit 4 PL $L2 $C2) && - PR=$(doit 4 PR $C2 $R2) + PR=$(doit 4 PR $C2 $R2) && git name-rev $C2 >expected && diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh index b66544b..80adaf6 100755 --- a/t/t6022-merge-rename.sh +++ b/t/t6022-merge-rename.sh @@ -332,7 +332,7 @@ test_expect_success 'interference with untracked working tree file' ' ' test_expect_success 'merge of identical changes in a renamed file' ' - rm -f A M N + rm -f A M N && git reset --hard && git checkout change+rename && GIT_MERGE_VERBOSITY=3 git merge change | grep "^Skipped B" && diff --git a/t/t6024-recursive-merge.sh b/t/t6024-recursive-merge.sh index b3fbf65..755d30c 100755 --- a/t/t6024-recursive-merge.sh +++ b/t/t6024-recursive-merge.sh @@ -104,7 +104,7 @@ test_expect_success 'mark rename/delete as unmerged' ' test_tick && git commit -m delete && git checkout -b rename HEAD^ && - git mv a1 a2 + git mv a1 a2 && test_tick && git commit -m rename && test_must_fail git merge delete && diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 3b042aa..b5063b6 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -517,13 +517,13 @@ test_expect_success '"parallel" side branch creation' ' add_line_into_file "2(para): line 2 on parallel branch" dir2/file2 && PARA_HASH2=$(git rev-parse --verify HEAD) && add_line_into_file "3(para): line 3 on parallel branch" dir2/file3 && - PARA_HASH3=$(git rev-parse --verify HEAD) + PARA_HASH3=$(git rev-parse --verify HEAD) && git merge -m "merge HASH4 and PARA_HASH3" "$HASH4" && - PARA_HASH4=$(git rev-parse --verify HEAD) + PARA_HASH4=$(git rev-parse --verify HEAD) && add_line_into_file "5(para): add line on parallel branch" dir1/file1 && - PARA_HASH5=$(git rev-parse --verify HEAD) + PARA_HASH5=$(git rev-parse --verify HEAD) && add_line_into_file "6(para): add line on parallel branch" dir2/file2 && - PARA_HASH6=$(git rev-parse --verify HEAD) + PARA_HASH6=$(git rev-parse --verify HEAD) && git merge -m "merge HASH7 and PARA_HASH6" "$HASH7" && PARA_HASH7=$(git rev-parse --verify HEAD) ' diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh index 1785e17..1e0447f 100755 --- a/t/t6040-tracking-info.sh +++ b/t/t6040-tracking-info.sh @@ -60,7 +60,7 @@ test_expect_success 'checkout' ' test_expect_success 'checkout with local tracked branch' ' git checkout master && - git checkout follower >actual + git checkout follower >actual && grep "is ahead of" actual ' diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index ac943f5..ee44331 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -1122,7 +1122,7 @@ v2.0 EOF test_expect_success 'checking that first commit is in all tags (hash)' " - git tag -l --contains $hash1 v* >actual + git tag -l --contains $hash1 v* >actual && test_cmp expected actual " @@ -1201,18 +1201,18 @@ v4.0 EOF test_expect_success 'checking that initial commit is in all tags' " - git tag -l --contains $hash1 v* >actual + git tag -l --contains $hash1 v* >actual && test_cmp expected actual " # mixing modes and options: test_expect_success 'mixing incompatibles modes and options is forbidden' ' - test_must_fail git tag -a - test_must_fail git tag -l -v - test_must_fail git tag -n 100 - test_must_fail git tag -l -m msg - test_must_fail git tag -l -F some file + test_must_fail git tag -a && + test_must_fail git tag -l -v && + test_must_fail git tag -n 100 && + test_must_fail git tag -l -m msg && + test_must_fail git tag -l -F some file && test_must_fail git tag -v -s ' diff --git a/t/t7105-reset-patch.sh b/t/t7105-reset-patch.sh index 9891e2c..95fab20 100755 --- a/t/t7105-reset-patch.sh +++ b/t/t7105-reset-patch.sh @@ -18,7 +18,7 @@ test_expect_success PERL 'setup' ' # note: bar sorts before foo, so the first 'n' is always to skip 'bar' test_expect_success PERL 'saying "n" does nothing' ' - set_and_save_state dir/foo work work + set_and_save_state dir/foo work work && (echo n; echo n) | git reset -p && verify_saved_state dir/foo && verify_saved_state bar @@ -42,14 +42,14 @@ test_expect_success PERL 'git reset -p HEAD^' ' # the failure case (and thus get out of the loop). test_expect_success PERL 'git reset -p dir' ' - set_state dir/foo work work + set_state dir/foo work work && (echo y; echo n) | git reset -p dir && verify_state dir/foo work head && verify_saved_state bar ' test_expect_success PERL 'git reset -p -- foo (inside dir)' ' - set_state dir/foo work work + set_state dir/foo work work && (echo y; echo n) | (cd dir && git reset -p -- foo) && verify_state dir/foo work head && verify_saved_state bar diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index 6c776e9..a37797d 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -183,7 +183,7 @@ test_expect_success 'git clean symbolic link' ' mkdir -p build docs && touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && - ln -s docs/manual.txt src/part4.c + ln -s docs/manual.txt src/part4.c && git clean && test -f Makefile && test -f README && @@ -404,7 +404,7 @@ test_expect_success 'nested git work tree' ' ( cd foo && git init && - >hello.world + >hello.world && git add . && git commit -a -m nested ) && @@ -424,7 +424,7 @@ test_expect_success 'force removal of nested git work tree' ' ( cd foo && git init && - >hello.world + >hello.world && git add . && git commit -a -m nested ) && diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index 8297cb4..2f8a4f4 100755 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -351,7 +351,7 @@ test_expect_success 'git commit <file> with dirty index' ' test_expect_success 'same tree (single parent)' ' - git reset --hard + git reset --hard && if git commit -m empty then diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh index ac2e187..b6b9802 100755 --- a/t/t7502-commit.sh +++ b/t/t7502-commit.sh @@ -390,7 +390,7 @@ try_commit_status_combo () { test_expect_success 'commit --no-status' ' clear_config commit.status && - try_commit --no-status + try_commit --no-status && ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG ' diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh index 3d4f85d..f497001 100755 --- a/t/t7506-status-submodule.sh +++ b/t/t7506-status-submodule.sh @@ -159,7 +159,7 @@ test_expect_success 'status with added and untracked file in modified submodule test_expect_success 'setup .git file for sub' ' (cd sub && - rm -f new-file + rm -f new-file && REAL="$(pwd)/../.real" && mv .git "$REAL" echo "gitdir: $REAL" >.git) && diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index b4f40e4..9351e1d 100755 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@ -128,7 +128,7 @@ test_expect_success 'setup' ' test_tick && git commit -m "commit 3" && git tag c3 && - c3=$(git rev-parse HEAD) + c3=$(git rev-parse HEAD) && git reset --hard "$c0" && create_merge_msgs ' diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh index 3bd7404..d78bdec 100755 --- a/t/t7610-mergetool.sh +++ b/t/t7610-mergetool.sh @@ -54,7 +54,7 @@ test_expect_success 'custom mergetool' ' test_expect_success 'mergetool crlf' ' git config core.autocrlf true && - git checkout -b test2 branch1 + git checkout -b test2 branch1 && test_must_fail git merge master >/dev/null 2>&1 && ( yes "" | git mergetool file1 >/dev/null 2>&1 ) && ( yes "" | git mergetool file2 >/dev/null 2>&1 ) && diff --git a/t/t7700-repack.sh b/t/t7700-repack.sh index c2f66ff..bd07f4e 100755 --- a/t/t7700-repack.sh +++ b/t/t7700-repack.sh @@ -56,7 +56,7 @@ test_expect_success 'loose objects in alternate ODB are not repacked' ' ' test_expect_success 'packed obs in alt ODB are repacked even when local repo is packless' ' - mkdir alt_objects/pack + mkdir alt_objects/pack && mv .git/objects/pack/* alt_objects/pack && git repack -a && myidx=$(ls -1 .git/objects/pack/*.idx) && diff --git a/t/t8003-blame.sh b/t/t8003-blame.sh index 230143c..ddabf4f 100755 --- a/t/t8003-blame.sh +++ b/t/t8003-blame.sh @@ -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' ' - TREE=`git rev-parse HEAD:` + TREE=`git rev-parse HEAD:` && cat >badcommit <<EOF tree $TREE author <noname> 1234567890 +0000 committer David Reiss <dreiss@facebook.com> 1234567890 +0000 some message -EOF - COMMIT=`git hash-object -t commit -w badcommit` +EOF && + COMMIT=`git hash-object -t commit -w badcommit` && git --no-pager blame $COMMIT -- uno >/dev/null ' diff --git a/t/t9122-git-svn-author.sh b/t/t9122-git-svn-author.sh index 30013b7..9fe0dd2 100755 --- a/t/t9122-git-svn-author.sh +++ b/t/t9122-git-svn-author.sh @@ -7,8 +7,8 @@ test_expect_success 'setup svn repository' ' svn_cmd checkout "$svnrepo" work.svn && ( cd work.svn && - echo >file - svn_cmd add file + echo >file && + svn_cmd add file && svn_cmd commit -m "first commit" file ) ' diff --git a/t/t9123-git-svn-rebuild-with-rewriteroot.sh b/t/t9123-git-svn-rebuild-with-rewriteroot.sh index 0ed90d9..fd81847 100755 --- a/t/t9123-git-svn-rebuild-with-rewriteroot.sh +++ b/t/t9123-git-svn-rebuild-with-rewriteroot.sh @@ -16,7 +16,7 @@ rm -rf import test_expect_success 'init, fetch and checkout repository' ' git svn init --rewrite-root=http://invalid.invalid/ "$svnrepo" && - git svn fetch + git svn fetch && git checkout -b mybranch ${remotes_git_svn} ' diff --git a/t/t9134-git-svn-ignore-paths.sh b/t/t9134-git-svn-ignore-paths.sh index 09ff10c..fff49c4 100755 --- a/t/t9134-git-svn-ignore-paths.sh +++ b/t/t9134-git-svn-ignore-paths.sh @@ -82,7 +82,7 @@ test_expect_success 'update git svn-cloned repo (option ignore)' ' test_expect_success 'SVN-side change inside of ignored www' ' ( cd s && - echo zaq >> www/test_www.txt + echo zaq >> www/test_www.txt && svn_cmd commit -m "SVN-side change inside of www/test_www.txt" && svn_cmd up && svn_cmd log -v | fgrep "SVN-side change inside of www/test_www.txt" @@ -114,8 +114,8 @@ test_expect_success 'update git svn-cloned repo (option ignore)' ' test_expect_success 'SVN-side change in and out of ignored www' ' ( cd s && - echo cvf >> www/test_www.txt - echo ygg >> qqq/test_qqq.txt + echo cvf >> www/test_www.txt && + echo ygg >> qqq/test_qqq.txt && svn_cmd commit -m "SVN-side change in and out of ignored www" && svn_cmd up && svn_cmd log -v | fgrep "SVN-side change in and out of ignored www" diff --git a/t/t9137-git-svn-dcommit-clobber-series.sh b/t/t9137-git-svn-dcommit-clobber-series.sh index d60da63..ad01487 100755 --- a/t/t9137-git-svn-dcommit-clobber-series.sh +++ b/t/t9137-git-svn-dcommit-clobber-series.sh @@ -7,7 +7,7 @@ test_description='git svn dcommit clobber series' test_expect_success 'initialize repo' ' mkdir import && (cd import && - awk "BEGIN { for (i = 1; i < 64; i++) { print i } }" > file + awk "BEGIN { for (i = 1; i < 64; i++) { print i } }" > file && svn_cmd import -m "initial" . "$svnrepo" ) && git svn init "$svnrepo" && diff --git a/t/t9138-git-svn-authors-prog.sh b/t/t9138-git-svn-authors-prog.sh index 83cc5fc..7102ab9 100755 --- a/t/t9138-git-svn-authors-prog.sh +++ b/t/t9138-git-svn-authors-prog.sh @@ -37,14 +37,14 @@ test_expect_success 'import authors with prog and file' ' test_expect_success 'imported 6 revisions successfully' ' ( - cd x + cd x && test "`git rev-list refs/remotes/git-svn | wc -l`" -eq 6 ) ' test_expect_success 'authors-prog ran correctly' ' ( - cd x + cd x && git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \ grep "^author ee-foo <ee-foo@example\.com> " && git rev-list -1 --pretty=raw refs/remotes/git-svn~2 | \ @@ -60,7 +60,7 @@ test_expect_success 'authors-prog ran correctly' ' test_expect_success 'authors-file overrode authors-prog' ' ( - cd x + cd x && git rev-list -1 --pretty=raw refs/remotes/git-svn | \ grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> " ) diff --git a/t/t9146-git-svn-empty-dirs.sh b/t/t9146-git-svn-empty-dirs.sh index 565365c..14b4c48 100755 --- a/t/t9146-git-svn-empty-dirs.sh +++ b/t/t9146-git-svn-empty-dirs.sh @@ -33,7 +33,7 @@ test_expect_success 'more emptiness' ' ' test_expect_success 'git svn rebase creates empty directory' ' - ( cd cloned && git svn rebase ) + ( cd cloned && git svn rebase ) && test -d cloned/"! !" ' @@ -65,13 +65,13 @@ test_expect_success 'git svn mkdirs -r works' ' echo >&2 "$i does not exist" exit 1 fi - done + done && if test -d "! !" then echo >&2 "$i should not exist" exit 1 - fi + fi && git svn mkdirs -r8 && if ! test -d "! !" diff --git a/t/t9151-svn-mergeinfo.sh b/t/t9151-svn-mergeinfo.sh index 250c651..4f6c06e 100755 --- a/t/t9151-svn-mergeinfo.sh +++ b/t/t9151-svn-mergeinfo.sh @@ -18,39 +18,39 @@ test_expect_success 'load svn dump' " test_expect_success 'all svn merges became git merge commits' ' unmarked=$(git rev-list --parents --all --grep=Merge | - grep -v " .* " | cut -f1 -d" ") + grep -v " .* " | cut -f1 -d" ") && [ -z "$unmarked" ] ' test_expect_success 'cherry picks did not become git merge commits' ' bad_cherries=$(git rev-list --parents --all --grep=Cherry | - grep " .* " | cut -f1 -d" ") + grep " .* " | cut -f1 -d" ") && [ -z "$bad_cherries" ] ' test_expect_success 'svn non-merge merge commits did not become git merge commits' ' bad_non_merges=$(git rev-list --parents --all --grep=non-merge | - grep " .* " | cut -f1 -d" ") + grep " .* " | cut -f1 -d" ") && [ -z "$bad_non_merges" ] ' test_expect_success 'commit made to merged branch is reachable from the merge' ' - before_commit=$(git rev-list --all --grep="trunk commit before merging trunk to b2") - merge_commit=$(git rev-list --all --grep="Merge trunk to b2") - not_reachable=$(git rev-list -1 $before_commit --not $merge_commit) + before_commit=$(git rev-list --all --grep="trunk commit before merging trunk to b2") && + merge_commit=$(git rev-list --all --grep="Merge trunk to b2") && + not_reachable=$(git rev-list -1 $before_commit --not $merge_commit) && [ -z "$not_reachable" ] ' test_expect_success 'merging two branches in one commit is detected correctly' ' - f1_commit=$(git rev-list --all --grep="make f1 branch from trunk") - f2_commit=$(git rev-list --all --grep="make f2 branch from trunk") - merge_commit=$(git rev-list --all --grep="Merge f1 and f2 to trunk") - not_reachable=$(git rev-list -1 $f1_commit $f2_commit --not $merge_commit) + f1_commit=$(git rev-list --all --grep="make f1 branch from trunk") && + f2_commit=$(git rev-list --all --grep="make f2 branch from trunk") && + merge_commit=$(git rev-list --all --grep="Merge f1 and f2 to trunk") && + not_reachable=$(git rev-list -1 $f1_commit $f2_commit --not $merge_commit) && [ -z "$not_reachable" ] ' test_expect_failure 'everything got merged in the end' ' - unmerged=$(git rev-list --all --not master) + unmerged=$(git rev-list --all --not master) && [ -z "$unmerged" ] ' diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh index e5da65b..70c1af0 100755 --- a/t/t9200-git-cvsexportcommit.sh +++ b/t/t9200-git-cvsexportcommit.sh @@ -182,7 +182,7 @@ test_expect_success \ git commit -a -m "Update with spaces" && id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && - git cvsexportcommit -c $id + git cvsexportcommit -c $id && check_entries "G g" "with spaces.png/1.2/-kb|with spaces.txt/1.2/" )' @@ -240,7 +240,7 @@ test_expect_success FILEMODE \ git add G/off && git commit -a -m "Execute test" && (cd "$CVSWORK" && - git cvsexportcommit -c HEAD + git cvsexportcommit -c HEAD && test -x G/on && ! test -x G/off )' diff --git a/t/t9401-git-cvsserver-crlf.sh b/t/t9401-git-cvsserver-crlf.sh index 1bbfd82..ff6d6fb 100755 --- a/t/t9401-git-cvsserver-crlf.sh +++ b/t/t9401-git-cvsserver-crlf.sh @@ -70,7 +70,7 @@ test_expect_success 'setup' ' mkdir subdir && echo "Another text file" > subdir/file.h && echo "Another binary: Q (this time CR)" | q_to_cr > subdir/withCr.bin && - echo "Mixed up NUL, but marked text: Q <- there" | q_to_nul > mixedUp.c + echo "Mixed up NUL, but marked text: Q <- there" | q_to_nul > mixedUp.c && echo "Unspecified" > subdir/unspecified.other && echo "/*.bin -crlf" > .gitattributes && echo "/*.c crlf" >> .gitattributes && diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh index 432b82e..db081e7 100755 --- a/t/t9600-cvsimport.sh +++ b/t/t9600-cvsimport.sh @@ -128,7 +128,7 @@ test_expect_success PERL 'second update has correct .git/cvs-revisions' ' (cd module-git && git log --format="o_fortuna 1.1 %H" -1 HEAD^^ && - git log --format="o_fortuna 1.2 %H" -1 HEAD^ + git log --format="o_fortuna 1.2 %H" -1 HEAD^ && git log --format="tick 1.1 %H" -1 HEAD) > expected && test_cmp expected module-git/.git/cvs-revisions ' -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCHv4 14/15] Add missing &&'s throughout the testsuite 2010-09-26 23:14 ` [PATCHv4 14/15] Add missing &&'s throughout the testsuite Elijah Newren @ 2010-09-29 19:37 ` Junio C Hamano 2010-10-01 0:48 ` Ævar Arnfjörð Bjarmason 2010-10-01 11:26 ` Jonathan Nieder 2 siblings, 0 replies; 51+ messages in thread From: Junio C Hamano @ 2010-09-29 19:37 UTC (permalink / raw) To: Elijah Newren; +Cc: git Elijah Newren <newren@gmail.com> writes: > diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh > index de38c7f..ddd1c23 100755 > --- a/t/t0003-attributes.sh > +++ b/t/t0003-attributes.sh > @@ -19,24 +19,23 @@ attr_check () { > test_expect_success 'setup' ' > > mkdir -p a/b/d a/c && > - ( > - echo "[attr]notest !test" > - echo "f test=f" > - echo "a/i test=a/i" > - echo "onoff test -test" > - echo "offon -test test" > - echo "no notest" > - ) >.gitattributes && > - ( > - echo "g test=a/g" && > - echo "b/g test=a/b/g" > - ) >a/.gitattributes && > - ( > - echo "h test=a/b/h" && > - echo "d/* test=a/b/d/*" > - echo "d/yes notest" > - ) >a/b/.gitattributes > - > + cat <<EOF >.gitattributes && If you are not doing any variable substitution in the here document, please quote EOF to make it clear, i.e. cat >.gitattributes <<\EOF && > @@ -73,7 +72,7 @@ offon: test: set > no: test: unspecified > a/b/d/no: test: a/b/d/* > a/b/d/yes: test: unspecified > -EOF > +EOF && Huh? Cascading && (or ||) goes on the first line of <<HERE document, as you wrote yourself in the above ;-) > diff --git a/t/t4119-apply-config.sh b/t/t4119-apply-config.sh > index 3c73a78..3d0384d 100755 > --- a/t/t4119-apply-config.sh > +++ b/t/t4119-apply-config.sh > @@ -73,7 +73,7 @@ D=`pwd` > test_expect_success 'apply --whitespace=strip in subdir' ' > > cd "$D" && > - git config --unset-all apply.whitespace > + git config --unset-all apply.whitespace && At this point, do we know that the previous test that added apply.whitespace to $D's configuration has successfully run and left the variable, or do we need to say this might-fail? > diff --git a/t/t8003-blame.sh b/t/t8003-blame.sh > index 230143c..ddabf4f 100755 > --- a/t/t8003-blame.sh > +++ b/t/t8003-blame.sh > @@ -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' ' > - TREE=`git rev-parse HEAD:` > + TREE=`git rev-parse HEAD:` && > cat >badcommit <<EOF > tree $TREE > author <noname> 1234567890 +0000 > committer David Reiss <dreiss@facebook.com> 1234567890 +0000 > > some message > -EOF > - COMMIT=`git hash-object -t commit -w badcommit` > +EOF && Huh, again? ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 14/15] Add missing &&'s throughout the testsuite 2010-09-26 23:14 ` [PATCHv4 14/15] Add missing &&'s throughout the testsuite Elijah Newren 2010-09-29 19:37 ` Junio C Hamano @ 2010-10-01 0:48 ` Ævar Arnfjörð Bjarmason 2010-10-01 11:26 ` Jonathan Nieder 2 siblings, 0 replies; 51+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2010-10-01 0:48 UTC (permalink / raw) To: Elijah Newren; +Cc: git, gitster On Sun, Sep 26, 2010 at 23:14, Elijah Newren <newren@gmail.com> wrote: > test_expect_success 'did not use upload-pack service' ' > - grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act > - : >exp > + grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act && > + >exp && > test_cmp exp act > ' This test started failing in pu, I'm presuming you didn't spot it since you didn't run the tests with GIT_TEST_HTTPD=1. Anyway, that grep should be a "! grep" to work with &&. ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 14/15] Add missing &&'s throughout the testsuite 2010-09-26 23:14 ` [PATCHv4 14/15] Add missing &&'s throughout the testsuite Elijah Newren 2010-09-29 19:37 ` Junio C Hamano 2010-10-01 0:48 ` Ævar Arnfjörð Bjarmason @ 2010-10-01 11:26 ` Jonathan Nieder 2 siblings, 0 replies; 51+ messages in thread From: Jonathan Nieder @ 2010-10-01 11:26 UTC (permalink / raw) To: Elijah Newren; +Cc: git, gitster, Nguyễn Thái Ngọc Duy (+cc: Duy for t1509) Elijah Newren wrote: > --- a/t/t0003-attributes.sh > +++ b/t/t0003-attributes.sh > @@ -19,24 +19,23 @@ attr_check () { > test_expect_success 'setup' ' > > mkdir -p a/b/d a/c && > - ( > - echo "[attr]notest !test" > + cat <<EOF >.gitattributes && > +[attr]notest !test Fits with the style of later tests in the file. Nice. [...] > --- a/t/t1509-root-worktree.sh > +++ b/t/t1509-root-worktree.sh > @@ -209,7 +209,7 @@ unset GIT_WORK_TREE > > test_expect_success 'go to /' 'cd /' > test_expect_success 'setup' ' > - rm -rf /.git > + rm -rf /.git && > echo "Initialized empty Git repository in /.git/" > expected && > git init > result && > test_cmp expected result > @@ -232,8 +232,8 @@ say "auto bare gitdir" > > # DESTROYYYYY!!!!! > test_expect_success 'setup' ' > - rm -rf /refs /objects /info /hooks > - rm /* > + rm -rf /refs /objects /info /hooks && > + rm /* && Hmm, I am not sure I trust this one... [...] > --- a/t/t3406-rebase-message.sh > +++ b/t/t3406-rebase-message.sh > @@ -43,20 +43,20 @@ test_expect_success 'rebase -m' ' > ' > > test_expect_success 'rebase --stat' ' > - git reset --hard start > + git reset --hard start && > git rebase --stat master >diffstat.txt && > grep "^ fileX | *1 +$" diffstat.txt > ' > > test_expect_success 'rebase w/config rebase.stat' ' > - git reset --hard start > + git reset --hard start && > git config rebase.stat true && > git rebase master >diffstat.txt && > grep "^ fileX | *1 +$" diffstat.txt > ' > > test_expect_success 'rebase -n overrides config rebase.stat config' ' > - git reset --hard start > + git reset --hard start && > git config rebase.stat true && > git rebase -n master >diffstat.txt && > ! grep "^ fileX | *1 +$" diffstat.txt Shouldn't these tabs be spaces to blend in with their surroundings? > --- a/t/t4119-apply-config.sh > +++ b/t/t4119-apply-config.sh > @@ -73,7 +73,7 @@ D=`pwd` > test_expect_success 'apply --whitespace=strip in subdir' ' > > cd "$D" && > - git config --unset-all apply.whitespace > + git config --unset-all apply.whitespace && test_might_fail? Aside from the problems Ævar and Junio found, the rest looks good to me, but I have not tested it. --- diff --git a/t/t1509-root-worktree.sh b/t/t1509-root-worktree.sh index e3391b7..7f60fd0 100755 --- a/t/t1509-root-worktree.sh +++ b/t/t1509-root-worktree.sh @@ -209,7 +209,7 @@ unset GIT_WORK_TREE test_expect_success 'go to /' 'cd /' test_expect_success 'setup' ' - rm -rf /.git && + rm -rf /.git echo "Initialized empty Git repository in /.git/" > expected && git init > result && test_cmp expected result @@ -232,8 +232,8 @@ say "auto bare gitdir" # DESTROYYYYY!!!!! test_expect_success 'setup' ' - rm -rf /refs /objects /info /hooks && - rm /* && + rm -rf /refs /objects /info /hooks + rm /* cd / && echo "Initialized empty Git repository in /" > expected && git init --bare > result && diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh index fe5f936..506d37e 100755 --- a/t/t3406-rebase-message.sh +++ b/t/t3406-rebase-message.sh @@ -43,20 +43,20 @@ test_expect_success 'rebase -m' ' ' test_expect_success 'rebase --stat' ' - git reset --hard start && + git reset --hard start && git rebase --stat master >diffstat.txt && grep "^ fileX | *1 +$" diffstat.txt ' test_expect_success 'rebase w/config rebase.stat' ' - git reset --hard start && + git reset --hard start && git config rebase.stat true && git rebase master >diffstat.txt && grep "^ fileX | *1 +$" diffstat.txt ' test_expect_success 'rebase -n overrides config rebase.stat config' ' - git reset --hard start && + git reset --hard start && git config rebase.stat true && git rebase -n master >diffstat.txt && ! grep "^ fileX | *1 +$" diffstat.txt diff --git a/t/t4119-apply-config.sh b/t/t4119-apply-config.sh index 3d0384d..82e0099 100755 --- a/t/t4119-apply-config.sh +++ b/t/t4119-apply-config.sh @@ -73,7 +73,7 @@ D=`pwd` test_expect_success 'apply --whitespace=strip in subdir' ' cd "$D" && - git config --unset-all apply.whitespace && + test_might_fail git config --unset-all apply.whitespace && rm -f sub/file1 && cp saved sub/file1 && git update-index --refresh && -- ^ permalink raw reply related [flat|nested] 51+ messages in thread
* [PATCHv4 15/15] Replace "unset VAR" with "unset VAR;" in testsuite as per t/README 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren ` (13 preceding siblings ...) 2010-09-26 23:14 ` [PATCHv4 14/15] Add missing &&'s throughout the testsuite Elijah Newren @ 2010-09-26 23:14 ` Elijah Newren 2010-09-29 19:48 ` Junio C Hamano 14 siblings, 1 reply; 51+ messages in thread From: Elijah Newren @ 2010-09-26 23:14 UTC (permalink / raw) To: git; +Cc: gitster, Elijah Newren Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@gmail.com> --- t/t0001-init.sh | 28 ++++++++++++++-------------- t/t7502-commit.sh | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 9d4539f..3c2afb3 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -25,7 +25,7 @@ check_config () { test_expect_success 'plain' ' ( - unset GIT_DIR GIT_WORK_TREE + unset GIT_DIR GIT_WORK_TREE; mkdir plain && cd plain && git init @@ -35,7 +35,7 @@ test_expect_success 'plain' ' test_expect_success 'plain with GIT_WORK_TREE' ' if ( - unset GIT_DIR + unset GIT_DIR; mkdir plain-wt && cd plain-wt && GIT_WORK_TREE=$(pwd) git init @@ -48,7 +48,7 @@ test_expect_success 'plain with GIT_WORK_TREE' ' test_expect_success 'plain bare' ' ( - unset GIT_DIR GIT_WORK_TREE GIT_CONFIG + unset GIT_DIR GIT_WORK_TREE GIT_CONFIG; mkdir plain-bare-1 && cd plain-bare-1 && git --bare init @@ -58,7 +58,7 @@ test_expect_success 'plain bare' ' test_expect_success 'plain bare with GIT_WORK_TREE' ' if ( - unset GIT_DIR GIT_CONFIG + unset GIT_DIR GIT_CONFIG; mkdir plain-bare-2 && cd plain-bare-2 && GIT_WORK_TREE=$(pwd) git --bare init @@ -72,7 +72,7 @@ test_expect_success 'plain bare with GIT_WORK_TREE' ' test_expect_success 'GIT_DIR bare' ' ( - unset GIT_CONFIG + unset GIT_CONFIG; mkdir git-dir-bare.git && GIT_DIR=git-dir-bare.git git init ) && @@ -82,7 +82,7 @@ test_expect_success 'GIT_DIR bare' ' test_expect_success 'init --bare' ' ( - unset GIT_DIR GIT_WORK_TREE GIT_CONFIG + unset GIT_DIR GIT_WORK_TREE GIT_CONFIG; mkdir init-bare.git && cd init-bare.git && git init --bare @@ -93,7 +93,7 @@ test_expect_success 'init --bare' ' test_expect_success 'GIT_DIR non-bare' ' ( - unset GIT_CONFIG + unset GIT_CONFIG; mkdir non-bare && cd non-bare && GIT_DIR=.git git init @@ -104,7 +104,7 @@ test_expect_success 'GIT_DIR non-bare' ' test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' ' ( - unset GIT_CONFIG + unset GIT_CONFIG; mkdir git-dir-wt-1.git && GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-1.git git init ) && @@ -114,7 +114,7 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' ' test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' ' if ( - unset GIT_CONFIG + unset GIT_CONFIG; mkdir git-dir-wt-2.git && GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-2.git git --bare init ) @@ -127,7 +127,7 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' ' test_expect_success 'reinit' ' ( - unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG + unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG; mkdir again && cd again && @@ -175,8 +175,8 @@ test_expect_success 'init with init.templatedir set' ' git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" && mkdir templatedir-set && cd templatedir-set && - unset GIT_CONFIG_NOGLOBAL && - unset GIT_TEMPLATE_DIR && + unset GIT_CONFIG_NOGLOBAL; + unset GIT_TEMPLATE_DIR; NO_SET_GIT_TEMPLATE_DIR=t && export NO_SET_GIT_TEMPLATE_DIR && git init @@ -187,7 +187,7 @@ test_expect_success 'init with init.templatedir set' ' test_expect_success 'init --bare/--shared overrides system/global config' ' ( test_config="$HOME"/.gitconfig && - unset GIT_CONFIG_NOGLOBAL && + unset GIT_CONFIG_NOGLOBAL; git config -f "$test_config" core.bare false && git config -f "$test_config" core.sharedRepository 0640 && mkdir init-bare-shared-override && @@ -202,7 +202,7 @@ test_expect_success 'init --bare/--shared overrides system/global config' ' test_expect_success 'init honors global core.sharedRepository' ' ( test_config="$HOME"/.gitconfig && - unset GIT_CONFIG_NOGLOBAL && + unset GIT_CONFIG_NOGLOBAL; git config -f "$test_config" core.sharedRepository 0666 && mkdir shared-honor-global && cd shared-honor-global && diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh index b6b9802..129ac15 100755 --- a/t/t7502-commit.sh +++ b/t/t7502-commit.sh @@ -252,8 +252,8 @@ test_expect_success 'committer is automatic' ' echo >>negative && ( - unset GIT_COMMITTER_EMAIL - unset GIT_COMMITTER_NAME + unset GIT_COMMITTER_EMAIL; + unset GIT_COMMITTER_NAME; # must fail because there is no change test_must_fail git commit -e -m "sample" ) && -- 1.7.3.95.g14291 ^ permalink raw reply related [flat|nested] 51+ messages in thread
* Re: [PATCHv4 15/15] Replace "unset VAR" with "unset VAR;" in testsuite as per t/README 2010-09-26 23:14 ` [PATCHv4 15/15] Replace "unset VAR" with "unset VAR;" in testsuite as per t/README Elijah Newren @ 2010-09-29 19:48 ` Junio C Hamano 2010-09-29 20:28 ` Ævar Arnfjörð Bjarmason 2010-09-29 20:30 ` Elijah Newren 0 siblings, 2 replies; 51+ messages in thread From: Junio C Hamano @ 2010-09-29 19:48 UTC (permalink / raw) To: Elijah Newren; +Cc: git Elijah Newren <newren@gmail.com> writes: > Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> > Signed-off-by: Elijah Newren <newren@gmail.com> > --- > @@ -175,8 +175,8 @@ test_expect_success 'init with init.templatedir set' ' > git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" && > mkdir templatedir-set && > cd templatedir-set && > - unset GIT_CONFIG_NOGLOBAL && > - unset GIT_TEMPLATE_DIR && > + unset GIT_CONFIG_NOGLOBAL; > + unset GIT_TEMPLATE_DIR; > NO_SET_GIT_TEMPLATE_DIR=t && > export NO_SET_GIT_TEMPLATE_DIR && > git init > @@ -187,7 +187,7 @@ test_expect_success 'init with init.templatedir set' ' > test_expect_success 'init --bare/--shared overrides system/global config' ' > ( > test_config="$HOME"/.gitconfig && > - unset GIT_CONFIG_NOGLOBAL && > + unset GIT_CONFIG_NOGLOBAL; > git config -f "$test_config" core.bare false && > git config -f "$test_config" core.sharedRepository 0640 && > mkdir init-bare-shared-override && > @@ -202,7 +202,7 @@ test_expect_success 'init --bare/--shared overrides system/global config' ' > test_expect_success 'init honors global core.sharedRepository' ' > ( > test_config="$HOME"/.gitconfig && > - unset GIT_CONFIG_NOGLOBAL && > + unset GIT_CONFIG_NOGLOBAL; > git config -f "$test_config" core.sharedRepository 0666 && > mkdir shared-honor-global && > cd shared-honor-global && These three hunks look wrong as they break the && cascades. All others (including the change to 7502) look Ok. Personally I do not agree that ";" at the end is explicit enough as t/README seems to think. If we want to be explicit, I'd say we should do so by saying something like: unset VAR ;# can fail ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 15/15] Replace "unset VAR" with "unset VAR;" in testsuite as per t/README 2010-09-29 19:48 ` Junio C Hamano @ 2010-09-29 20:28 ` Ævar Arnfjörð Bjarmason 2010-09-29 20:30 ` Elijah Newren 1 sibling, 0 replies; 51+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2010-09-29 20:28 UTC (permalink / raw) To: Junio C Hamano; +Cc: Elijah Newren, git On Wed, Sep 29, 2010 at 19:48, Junio C Hamano <gitster@pobox.com> wrote: > Elijah Newren <newren@gmail.com> writes: > >> Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> >> Signed-off-by: Elijah Newren <newren@gmail.com> >> --- >> @@ -175,8 +175,8 @@ test_expect_success 'init with init.templatedir set' ' >> git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" && >> mkdir templatedir-set && >> cd templatedir-set && >> - unset GIT_CONFIG_NOGLOBAL && >> - unset GIT_TEMPLATE_DIR && >> + unset GIT_CONFIG_NOGLOBAL; >> + unset GIT_TEMPLATE_DIR; >> NO_SET_GIT_TEMPLATE_DIR=t && >> export NO_SET_GIT_TEMPLATE_DIR && >> git init >> @@ -187,7 +187,7 @@ test_expect_success 'init with init.templatedir set' ' >> test_expect_success 'init --bare/--shared overrides system/global config' ' >> ( >> test_config="$HOME"/.gitconfig && >> - unset GIT_CONFIG_NOGLOBAL && >> + unset GIT_CONFIG_NOGLOBAL; >> git config -f "$test_config" core.bare false && >> git config -f "$test_config" core.sharedRepository 0640 && >> mkdir init-bare-shared-override && >> @@ -202,7 +202,7 @@ test_expect_success 'init --bare/--shared overrides system/global config' ' >> test_expect_success 'init honors global core.sharedRepository' ' >> ( >> test_config="$HOME"/.gitconfig && >> - unset GIT_CONFIG_NOGLOBAL && >> + unset GIT_CONFIG_NOGLOBAL; >> git config -f "$test_config" core.sharedRepository 0666 && >> mkdir shared-honor-global && >> cd shared-honor-global && > > These three hunks look wrong as they break the && cascades. All others > (including the change to 7502) look Ok. > > Personally I do not agree that ";" at the end is explicit enough as > t/README seems to think. If we want to be explicit, I'd say we should do > so by saying something like: > > unset VAR ;# can fail Or, as previously suggested: test_might_fail unset VAR && Doesn't test_might_fail work for the unset build-in too? ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 15/15] Replace "unset VAR" with "unset VAR;" in testsuite as per t/README 2010-09-29 19:48 ` Junio C Hamano 2010-09-29 20:28 ` Ævar Arnfjörð Bjarmason @ 2010-09-29 20:30 ` Elijah Newren 2010-09-30 16:09 ` Junio C Hamano 1 sibling, 1 reply; 51+ messages in thread From: Elijah Newren @ 2010-09-29 20:30 UTC (permalink / raw) To: Junio C Hamano; +Cc: git Hi, Thanks for all the reviews. I'll fix things up. One question on this last one... On Wed, Sep 29, 2010 at 1:48 PM, Junio C Hamano <gitster@pobox.com> wrote: > Elijah Newren <newren@gmail.com> writes: > >> Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> >> Signed-off-by: Elijah Newren <newren@gmail.com> >> --- >> @@ -175,8 +175,8 @@ test_expect_success 'init with init.templatedir set' ' >> git config -f "$test_config" init.templatedir "${HOME}/templatedir-source" && >> mkdir templatedir-set && >> cd templatedir-set && >> - unset GIT_CONFIG_NOGLOBAL && >> - unset GIT_TEMPLATE_DIR && >> + unset GIT_CONFIG_NOGLOBAL; >> + unset GIT_TEMPLATE_DIR; >> NO_SET_GIT_TEMPLATE_DIR=t && >> export NO_SET_GIT_TEMPLATE_DIR && >> git init >> @@ -187,7 +187,7 @@ test_expect_success 'init with init.templatedir set' ' >> test_expect_success 'init --bare/--shared overrides system/global config' ' >> ( >> test_config="$HOME"/.gitconfig && >> - unset GIT_CONFIG_NOGLOBAL && >> + unset GIT_CONFIG_NOGLOBAL; >> git config -f "$test_config" core.bare false && >> git config -f "$test_config" core.sharedRepository 0640 && >> mkdir init-bare-shared-override && >> @@ -202,7 +202,7 @@ test_expect_success 'init --bare/--shared overrides system/global config' ' >> test_expect_success 'init honors global core.sharedRepository' ' >> ( >> test_config="$HOME"/.gitconfig && >> - unset GIT_CONFIG_NOGLOBAL && >> + unset GIT_CONFIG_NOGLOBAL; >> git config -f "$test_config" core.sharedRepository 0666 && >> mkdir shared-honor-global && >> cd shared-honor-global && > > These three hunks look wrong as they break the && cascades. All others > (including the change to 7502) look Ok. They break the && cascades, but aren't the && cascades already inherently broken due to the unportable return value of unset? > Personally I do not agree that ";" at the end is explicit enough as > t/README seems to think. If we want to be explicit, I'd say we should do > so by saying something like: > > unset VAR ;# can fail That makes sense. Alternatively, I asked in an earlier posting of this series whether it would it make sense to add a portable_unset () { unset $* || true } helper function to test-lib, and just use it instead of unset? That would allow proper chaining everywhere. Thoughts? ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 15/15] Replace "unset VAR" with "unset VAR;" in testsuite as per t/README 2010-09-29 20:30 ` Elijah Newren @ 2010-09-30 16:09 ` Junio C Hamano 2010-09-30 21:51 ` Elijah Newren 0 siblings, 1 reply; 51+ messages in thread From: Junio C Hamano @ 2010-09-30 16:09 UTC (permalink / raw) To: Elijah Newren; +Cc: git Elijah Newren <newren@gmail.com> writes: > They break the && cascades, but aren't the && cascades already > inherently broken due to the unportable return value of unset? Of course; that is the breakage you are trying to fix, no? My comment was that I understand you are trying to, but the patch is not actually fixing it. If anything, it is making it worse. Earlier we would have got a false breakage that would make people notice and take a look. With your patch applied, we instead would let a breakage in parts earlier than these "unset VAR;" go unnoticed, no? ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 15/15] Replace "unset VAR" with "unset VAR;" in testsuite as per t/README 2010-09-30 16:09 ` Junio C Hamano @ 2010-09-30 21:51 ` Elijah Newren 2010-10-01 11:45 ` Jonathan Nieder 0 siblings, 1 reply; 51+ messages in thread From: Elijah Newren @ 2010-09-30 21:51 UTC (permalink / raw) To: Junio C Hamano; +Cc: git On Thu, Sep 30, 2010 at 10:09 AM, Junio C Hamano <gitster@pobox.com> wrote: > Elijah Newren <newren@gmail.com> writes: > >> They break the && cascades, but aren't the && cascades already >> inherently broken due to the unportable return value of unset? > > Of course; that is the breakage you are trying to fix, no? My comment was > that I understand you are trying to, but the patch is not actually fixing > it. > > If anything, it is making it worse. Earlier we would have got a false > breakage that would make people notice and take a look. With your patch > applied, we instead would let a breakage in parts earlier than these > "unset VAR;" go unnoticed, no? Right. What do you think of the previous suggestions in this thread for a portable_unset() function, or for using test_might_fail in front of all these unset commands (despite t/README saying that test_might_fail is only for running git commands)? ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 15/15] Replace "unset VAR" with "unset VAR;" in testsuite as per t/README 2010-09-30 21:51 ` Elijah Newren @ 2010-10-01 11:45 ` Jonathan Nieder 2010-10-01 14:39 ` Sverre Rabbelier 0 siblings, 1 reply; 51+ messages in thread From: Jonathan Nieder @ 2010-10-01 11:45 UTC (permalink / raw) To: Elijah Newren; +Cc: Junio C Hamano, git Elijah Newren wrote: > What do you think of the previous suggestions in this thread for a > portable_unset() function That sounds fine. Or if they are rare enough, one can use { unset FOO BAR BAZ || :; } > , or for using test_might_fail in front of > all these unset commands I fear this would make it harder for new readers to understand what test_might_fail does. But if a new function to run "foo || true" is needed, I wouldn't be opposed to adding one with a different name. ^ permalink raw reply [flat|nested] 51+ messages in thread
* Re: [PATCHv4 15/15] Replace "unset VAR" with "unset VAR;" in testsuite as per t/README 2010-10-01 11:45 ` Jonathan Nieder @ 2010-10-01 14:39 ` Sverre Rabbelier 0 siblings, 0 replies; 51+ messages in thread From: Sverre Rabbelier @ 2010-10-01 14:39 UTC (permalink / raw) To: Jonathan Nieder; +Cc: Elijah Newren, Junio C Hamano, git Heya, On Fri, Oct 1, 2010 at 13:45, Jonathan Nieder <jrnieder@gmail.com> wrote: > I fear this would make it harder for new readers to understand what > test_might_fail does. But if a new function to run "foo || true" is > needed, I wouldn't be opposed to adding one with a different name. cmd_might_fail? -- Cheers, Sverre Rabbelier ^ permalink raw reply [flat|nested] 51+ messages in thread
end of thread, other threads:[~2010-10-03 3:10 UTC | newest] Thread overview: 51+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-09-26 23:14 [PATCHv4 00/15] Add missing &&'s in the testsuite Elijah Newren 2010-09-26 23:14 ` [PATCHv4 01/15] t3020 (ls-files-error-unmatch): remove stray '1' from end of file Elijah Newren 2010-09-26 23:14 ` [PATCHv4 02/15] t4017 (diff-retval): replace manual exit code check with test_expect_code Elijah Newren 2010-09-29 18:07 ` Junio C Hamano 2010-09-29 18:45 ` Ævar Arnfjörð Bjarmason 2010-10-01 10:23 ` Jonathan Nieder 2010-10-01 10:38 ` Ævar Arnfjörð Bjarmason 2010-10-01 11:52 ` Jonathan Nieder 2010-10-01 16:20 ` Junio C Hamano 2010-10-01 17:16 ` [PATCH] test-lib: make test_expect_code a test command Ævar Arnfjörð Bjarmason 2010-10-01 17:39 ` Sverre Rabbelier 2010-10-01 17:46 ` Ævar Arnfjörð Bjarmason 2010-10-01 17:47 ` Sverre Rabbelier 2010-10-01 17:42 ` [PATCH v2] " Ævar Arnfjörð Bjarmason 2010-10-01 18:55 ` [PATCH] " Jonathan Nieder 2010-09-26 23:14 ` [PATCHv4 03/15] t100[12] (read-tree-m-2way, read_tree_m_u_2way): add missing && Elijah Newren 2010-09-29 18:28 ` Junio C Hamano 2010-10-01 10:27 ` Jonathan Nieder 2010-09-26 23:14 ` [PATCHv4 04/15] t4002 (diff-basic): use test_might_fail for commands that might fail Elijah Newren 2010-10-01 10:35 ` Jonathan Nieder 2010-09-26 23:14 ` [PATCHv4 05/15] t4202 (log): Replace '<git-command> || :' with test_might_fail Elijah Newren 2010-09-26 23:14 ` [PATCHv4 06/15] t3600 (rm): add lots of missing && Elijah Newren 2010-10-01 10:48 ` Jonathan Nieder 2010-10-03 2:47 ` Elijah Newren 2010-09-26 23:14 ` [PATCHv4 07/15] t4019 (diff-wserror): " Elijah Newren 2010-09-29 19:01 ` Junio C Hamano 2010-10-03 3:03 ` Elijah Newren 2010-10-01 11:00 ` Jonathan Nieder 2010-09-26 23:14 ` [PATCHv4 08/15] t4026 (color): remove unneeded and unchained command Elijah Newren 2010-09-26 23:14 ` [PATCHv4 09/15] t5602 (clone-remote-exec): add missing && Elijah Newren 2010-09-29 19:09 ` Junio C Hamano 2010-10-01 11:34 ` Jonathan Nieder 2010-10-03 3:08 ` Elijah Newren 2010-09-26 23:14 ` [PATCHv4 10/15] t6016 (rev-list-graph-simplify-history): " Elijah Newren 2010-09-27 0:10 ` Jonathan Nieder 2010-09-26 23:14 ` [PATCHv4 11/15] t7001 (mv): " Elijah Newren 2010-09-26 23:14 ` [PATCHv4 12/15] t7601 (merge-pull-config): " Elijah Newren 2010-09-26 23:14 ` [PATCHv4 13/15] t7800 (difftool): " Elijah Newren 2010-10-01 11:30 ` Jonathan Nieder 2010-09-26 23:14 ` [PATCHv4 14/15] Add missing &&'s throughout the testsuite Elijah Newren 2010-09-29 19:37 ` Junio C Hamano 2010-10-01 0:48 ` Ævar Arnfjörð Bjarmason 2010-10-01 11:26 ` Jonathan Nieder 2010-09-26 23:14 ` [PATCHv4 15/15] Replace "unset VAR" with "unset VAR;" in testsuite as per t/README Elijah Newren 2010-09-29 19:48 ` Junio C Hamano 2010-09-29 20:28 ` Ævar Arnfjörð Bjarmason 2010-09-29 20:30 ` Elijah Newren 2010-09-30 16:09 ` Junio C Hamano 2010-09-30 21:51 ` Elijah Newren 2010-10-01 11:45 ` Jonathan Nieder 2010-10-01 14:39 ` Sverre Rabbelier
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).