Add missing &&'s in the testsuite
v6 cover Add missing &&'s in the testsuite
This patch series fixes many of the missing &&s in the testsuite. Thanks to Junio, Jonathan, and Ævar for lots of time reviewing and making suggestions so far.
Changes since v5:
* Made changes suggested by Jonathan on v4. Notable items remaining:
* In patch 1, I made two of the changes suggested by Jonathan, but this was Ævar's patch so he may want to comment on those. Also, Jonathan had a few extra questions in the last round that perhaps Ævar may want to comment on.
* In patch 7 (t3600), there's still an outstanding question about what and how to change it.
* In patch 15, (the t1509 test), Jonathan pointed out a potential problem, and I'm unsure whether the change I made is what is wanted.
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
Introduce portable_unset and use it to ensure proper && chaining
Ævar Arnfjörð Bjarmason (1):
test-lib: make test_expect_code a test command
t/README | 29 +++++------ t/t0000-basic.sh | 55 +++++++++++++++++---- t/t0001-init.sh | 30 ++++++------ t/t0003-attributes.sh | 45 ++++++++--------- 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/t1504-ceiling-dirs.sh | 5 +- t/t1509-root-worktree.sh | 5 +- 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 | 69 ++++++++------------------- t/t4019-diff-wserror.sh | 53 ++++++++++---------- 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 | 22 ++++++--- 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 | 29 ++++------- t/t6020-merge-df.sh | 4 +- 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/t7006-pager.sh | 10 ++-- t/t7105-reset-patch.sh | 6 +- t/t7300-clean.sh | 8 ++-- 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 | 12 ++-- 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 +- t/test-lib.sh | 51 +++++++++++++------- 100 files changed, 429 insertions(+), 418 deletions(-)
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 1/16 test-lib: make test_expect_code a test command
From: Ævar Arnfjörð Bjarmason <[email protected]>
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. Note that test_expect_code has been made slightly noisier, as it reports the exit code it receives even upon success.
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.
--- 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(-)
t/README +9 -7
@@ -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> <command> + + Run a 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
t/t0000-basic.sh +45 -10
67 lines not on this page · raw message
t/t1504-ceiling-dirs.sh +3 -2
@@ -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"
t/t6020-merge-df.sh +3 -1
@@ -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 &&
t/test-lib.sh +22 -18
@@ -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: #
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 2/16 t3020 (ls-files-error-unmatch): remove stray '1' from end of file
In reply to Elijah Newren--- t/t3020-ls-files-error-unmatch.sh | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
t/t3020-ls-files-error-unmatch.sh +0 -1
@@ -26,4 +26,3 @@ test_expect_success \ 'git ls-files --error-unmatch foo bar' test_done -1
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 3/16 t4017 (diff-retval): replace manual exit code check with test_expect_code
In reply to Elijah NewrenThis commit takes advantage of Ævar Arnfjörð Bjarmason's recent change to test_expect_code (test-lib: make test_expect_code a test command) to simplify several testcases.
--- t/t4017-diff-retval.sh | 69 ++++++++++++++---------------------------------- 1 files changed, 20 insertions(+), 49 deletions(-)
t/t4017-diff-retval.sh +20 -49
@@ -29,66 +29,49 @@ test_expect_success 'git diff --quiet -w HEAD^ HEAD' ' ' test_expect_success 'git diff-tree HEAD^ HEAD' ' - git diff-tree --exit-code HEAD^ HEAD - test $? = 1 + test_expect_code 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 + test_expect_code 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 + echo $(git rev-parse HEAD) | test_expect_code 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 + test_expect_code 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 . && + test_expect_code 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" && + test_expect_code 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 && + test_expect_code 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 && + test_expect_code 1 git diff-index --exit-code --cached HEAD ' test_expect_success '--check --exit-code returns 0 for no difference' '
@@ -100,30 +83,26 @@ test_expect_success '--check --exit-code returns 0 for no difference' ' test_expect_success '--check --exit-code returns 1 for a clean difference' ' echo "good" > a && - git diff --check --exit-code - test $? = 1 + test_expect_code 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 + test_expect_code 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 + test_expect_code 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 + test_expect_code 2 git --no-pager diff --check '
@@ -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 && + test_expect_code 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 - ) && + test_expect_code 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 - ) && + test_expect_code 2 git diff --check b && git diff --check a && git reset --hard '
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 4/16 t100[12] (read-tree-m-2way, read_tree_m_u_2way): add missing &&
In reply to Elijah NewrenAlso, replace "|| return 1" with "&&" in order to keep commands chained.
--- t/t1001-read-tree-m-2way.sh | 18 +++++++++--------- t/t1002-read-tree-m-u-2way.sh | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-)
t/t1001-read-tree-m-2way.sh +9 -9
@@ -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_must_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_must_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_must_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_must_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` &&
t/t1002-read-tree-m-u-2way.sh +5 -5
@@ -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_must_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_must_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` &&
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 5/16 t4002 (diff-basic): use test_might_fail for commands that might fail
In reply to Elijah NewrenAlso replace '|| return 1' by '&&' to allow chain of operations to be checked for proper return status, and modify the update-index command as suggested by Jonathan Nieder to not exit early but try to make sure files that match the work tree are marked as matching.
--- t/t4002-diff-basic.sh | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
t/t4002-diff-basic.sh +6 -6
@@ -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_must_fail git update-index --refresh -q && 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_must_fail git update-index --refresh -q && 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_must_fail git update-index --refresh -q && git diff-files >.test-a && cmp_diff_files_output .test-a .test-recursive-AB'
Signature · 1 line
1.7.3.1.66.gab790
Re: [PATCHv6 01/16] test-lib: make test_expect_code a test command
In reply to Elijah Newrent/t0000-basic.sh test_expect_success 'tests clean up after themselves' ' · line 148
Quoted 12 lines · Elijah Newren
t/t0000-basic.sh +6
-0@@ -130,22 +130,57 @@ test_expect_success 'tests clean up after themselves' ' +#!$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\"
Do we know at this point that the string in $TEST_DIRECTORY can safely be quoted by just a simple dq pair? I don't think so--isn't the leading part of that string whatever the user can choose (i.e. $(cwd))?
This seems sloppy.
Quoted 1 line
+. \"\$TEST_DIRECTORY\"/test-lib.sh
Once you get the right value in TEST_DIRECTORY, this one is correct.
Re: [PATCHv6 01/16] test-lib: make test_expect_code a test command
Quoted 19 lines · Junio C Hamano
t/t0000-basic.sh test_expect_success 'tests clean up after themselves' ' · line 148
Quoted 12 lines · Elijah Newren
t/t0000-basic.sh +6
-0@@ -130,22 +130,57 @@ test_expect_success 'tests clean up after themselves' ' +#!$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\"Do we know at this point that the string in $TEST_DIRECTORY can safely be quoted by just a simple dq pair? I don't think so--isn't the leading part of that string whatever the user can choose (i.e. $(cwd))?
Quoted 5 lines
This seems sloppy.
Quoted 1 line
+. \"\$TEST_DIRECTORY\"/test-lib.sh
Once you get the right value in
TEST_DIRECTORY, this one is correct.
Wouldn't the issue you and Jonathan are talking about disappear with:
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index c2f5f8d..69e219b 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -58,7 +58,7 @@ test_expect_failure 'pretend we have a known breakage' '
test_expect_success 'pretend we have fixed a known breakage (runin sub test-lib)' "
mkdir passing-todo &&
(cd passing-todo &&
- cat >passing-todo.sh <<EOF &&
+ cat >passing-todo.sh <<\EOF &&
#!$SHELL_PATH
test_description='A passing TODO test
@@ -139,7 +139,7 @@ fi
test_expect_success 'tests clean up even on failures' "
mkdir failing-cleanup &&
(cd failing-cleanup &&
- cat >failing-cleanup.sh <<EOF &&
+ cat >failing-cleanup.sh <<\EOF &&
#!$SHELL_PATH
test_description='Failing tests with cleanup commands'
Note the change to passing-todo, that uses the same setup style.
With that the output of:
$ rm -rfv trash*; ./t0000-basic.sh --debug; cat trash\
directory.t0000-basic/{passing-todo,failing-cleanup}/*.shIs now (cut):
# Point to the t/test-lib.sh, which isn't in ../ as usual
TEST_DIRECTORY="/home/avar/g/git/t"
. "$TEST_DIRECTORY"/test-lib.sh
test_expect_failure 'pretend we have fixed a known breakage' '
:
'
test_done
#!/bin/sh
test_description='Failing tests with cleanup commands'
# Point to the t/test-lib.sh, which isn't in ../ as usual
TEST_DIRECTORY="/home/avar/g/git/t"
. "$TEST_DIRECTORY"/test-lib.shInstead of previously being:
# Point to the t/test-lib.sh, which isn't in ../ as usual
TEST_DIRECTORY="/home/avar/g/git/t"
. "/home/avar/g/git/t"/test-lib.sh
test_expect_failure 'pretend we have fixed a known breakage' '
:
'
test_done
#!/bin/sh
test_description='Failing tests with cleanup commands'
# Point to the t/test-lib.sh, which isn't in ../ as usual
TEST_DIRECTORY="/home/avar/g/git/t"
. "/home/avar/g/git/t"/test-lib.shI.e. before the TEST_DIRECTORY was always expanded.
Re: [PATCHv6 01/16] test-lib: make test_expect_code a test command
Quoted 10 lines · Ævar Arnfjörð Bjarmason
With that the output of:
$ rm -rfv trash*; ./t0000-basic.sh --debug; cat trash\ directory.t0000-basic/{passing-todo,failing-cleanup}/*.shIs now (cut):
# Point to the t/test-lib.sh, which isn't in ../ as usual TEST_DIRECTORY="/home/avar/g/git/t" . "$TEST_DIRECTORY"/test-lib.sh
Edge case: what if the path to the git directory contains a " character (for example because someone is trying to ensure that git commands can cope with such a cwd)?
I suspect the best thing would be to export TEST_DIRECTORY instead of including it inline in the script.
Re: [PATCHv6 01/16] test-lib: make test_expect_code a test command
Quoted 13 lines · Jonathan Nieder
Quoted 10 lines · Ævar Arnfjörð Bjarmason
With that the output of:
$ rm -rfv trash*; ./t0000-basic.sh --debug; cat trash\ directory.t0000-basic/{passing-todo,failing-cleanup}/*.shIs now (cut):
# Point to the
t/test-lib.sh, which isn't in ../ as usual TEST_DIRECTORY="/home/avar/g/git/t"
. "$TEST_DIRECTORY"/test-lib.sh
Quoted 6 lines
Edge case: what if the path to the git directory contains a " character (for example because someone is trying to ensure that git commands can cope with such a cwd)?
I suspect the best thing would be to export
TEST_DIRECTORYinstead of including it inline in the script.
We could do that, but then you couldn't cd to the trash directory and manually run the test without exporting the path to TEST_DIRECTORY again.
Personally I care more about that sort of edge case that I actually run into than someone testing Git under a crazy pathname.
Re: [PATCHv6 01/16] test-lib: make test_expect_code a test command
Quoted 8 lines · Ævar Arnfjörð Bjarmason
Quoted 2 lines · Jonathan Nieder
I suspect the best thing would be to export
TEST_DIRECTORYinstead of including it inline in the script.We could do that, but then you couldn't cd to the trash directory and manually run the test without exporting the path to
TEST_DIRECTORYagain.
Okay, then how about:
: ${TEST_DIRECTORY=$(cd ../.. && pwd)}
. "$TEST_DIRECTORY"/test-lib.shi.e., accepting TEST_DIRECTORY from the environment if and only if it is available?
Re: [PATCHv6 01/16] test-lib: make test_expect_code a test command
Quoted 10 lines · Jonathan Nieder
Quoted 8 lines · Ævar Arnfjörð Bjarmason
Quoted 2 lines · Jonathan Nieder
I suspect the best thing would be to export
TEST_DIRECTORYinstead of including it inline in the script.We could do that, but then you couldn't cd to the trash directory and manually run the test without exporting the path to
TEST_DIRECTORYagain.
Quoted 7 lines
Okay, then how about:
: ${TEST_DIRECTORY=$(cd ../.. && pwd)}
. "$TEST_DIRECTORY"/test-lib.shi.e., accepting
TEST_DIRECTORYfrom the environment if and only if it is available?
Maybe, if someone thinks it's worthwhile.
On the other hand I just tested git in a path called /tmp/\\"\\/git/t and found that every single one of our tests fail. So I think it would be better to just leave this as it is (but maybe apply the <<\EOF patch on top) and tackle the issue of the entire test suite breaking under insane path names in some later patch.
I don't see the point spending time fixing it here if nothing else works with crazy pathnames like these.
Re: [PATCHv6 01/16] test-lib: make test_expect_code a test command
Quoted 1 line · Ævar Arnfjörð Bjarmason
On the other hand I just tested git in a path called /tmp/\\"\\/git/t
I tried /tmp/test"git and tests other than t0000.5 seem to work fine.
Quoted 1 line
and found that every single one of our tests fail.
Every test script, not every test, right?
That's a makefile bug, I think: the bin-wrappers/% rule does not sed-quote the working directory before passing it to sed. After working around that with GIT_TEST_OPTS=--with-dashes, tests are running without trouble.
I don't think these edge cases are particularly important, but I do think it's better to make sure code that takes care of the edge cases when it's easy.
Re: [PATCHv6 01/16] test-lib: make test_expect_code a test command
In reply to Elijah NewrenQuoted 10 lines · Elijah Newren
From: Ævar Arnfjörð Bjarmason <[email protected]>
Change
test_expect_codeto be a normal test command instead of a top-level command.[...]
Signed-off-by Ævar Arnfjörð Bjarmason <[email protected]>Acked-by Jonathan Nieder <[email protected]>Signed-off-by Elijah Newren <[email protected]>
Quoted 7 lines
---
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(-)
This doc change looks. Here's the diff against my patch for reference:
diff --git a/t/README b/t/README
index c216e8c..ee4c0cf 100644
--- a/t/README
+++ b/t/README
@@ -475,10 +475,10 @@ library for your script to use.
'Perl API' \
"$PERL_PATH" "$TEST_DIRECTORY"/t9700/test.pl
- - test_expect_code <exit-code> <git-command>
+ - test_expect_code <exit-code> <command>
- Run a git command and ensure that it exits with the given exit
- code. For example:
+ Run a 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
Re: [PATCHv6 02/16] t3020 (ls-files-error-unmatch): remove stray '1' from end of file
In reply to Elijah NewrenThanks; I'll take this to 'maint' outside the context of this series, so we will have one less patch we have in the review ;-)
PATCH v6 6/16 t4202 (log): Replace '<git-command> || :' with test_might_fail
In reply to Elijah Newren--- t/t4202-log.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
t/t4202-log.sh +1 -1
@@ -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 &&
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 7/16 t3600 (rm): add lots of missing &&
In reply to Elijah NewrenAlso replace failing code with similar clean-up to set the appropriate state the test needs.
---
May be worth considering an alternative; from
http://thread.gmane.org/gmane.comp.version-control.git/157827/focus=157896:
Quoted 18 lines · Jonathan Nieder
Quoted 8 lines
Quoted 6 lines
test_expect_success\
'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' '(quoted diff) +1
-3- echo content > foo - git add foo - git commit -m foo + git checkout HEAD -- foo &&[...]
Quoted 8 lines
Why not
- echo content > foo - git add foo - git commit -m foo + echo content > foo && + git add foo && + git commit --allow-empty -m foo &&?
Quoted 4 lines
What advantage does using these three commands have over 'git checkout HEAD -- foo'? Perhaps I'm missing something, but I don't see it. It's three commands to one, and the tests don't depend on foo starting with contents of 'content'; just that foo matches HEAD to start.
Is there an advantage of the three-command version I'm just missing, or do people just prefer it?
t/t3600-rm.sh | 38 +++++++++++++++++--------------------- 1 files changed, 17 insertions(+), 21 deletions(-)
t/t3600-rm.sh +17 -21
@@ -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 && 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 + git checkout HEAD -- foo && + echo "other content" > foo && + git add foo && + echo "yet another content" > 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 + 'git checkout HEAD -- 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
Signature · 1 line
1.7.3.1.66.gab790
Re: [PATCHv6 07/16] t3600 (rm): add lots of missing &&
Quoted 11 lines · Elijah Newren
Quoted 11 lines · Jonathan Nieder
Quoted 9 lines
Why not
- echo content > foo - git add foo - git commit -m foo + echo content > foo && + git add foo && + git commit --allow-empty -m foo &&?
Quoted 6 lines
Quoted 4 lines
What advantage does using these three commands have over 'git checkout HEAD -- foo'? Perhaps I'm missing something, but I don't see it. It's three commands to one, and the tests don't depend on foo starting with contents of 'content'; just that foo matches HEAD to start.
Is there an advantage of the three-command version I'm just missing
What if the content of foo in HEAD were "other content"? Then the test would not be testing what it is supposed to.
Maybe you would prefer something like this on top? My only concern is to make sure the test is robust (even if people add new tests before these without paying much attention) and easy to read.
I suppose I am nitpicking excessively because I do not like to see regressions, even in out-of-the-way code like this.
---
t/t3600-rm.sh +12 -12
@@ -7,6 +7,15 @@ test_description='Test of the various options to git rm.' . ./test-lib.sh +prepare_foo () { + echo "$1" >foo && + git add foo && + git commit --allow-empty -m "set HEAD to $1" && + echo "$2" >foo && + git add foo && + echo "$3" >foo +} + # Setup some files to be removed, some with funny characters test_expect_success \ 'Initialize test directory' \
@@ -44,27 +53,18 @@ 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 && - git commit -m foo && - echo "other content" > foo && + 'prepare_foo content content "other content" && git rm --cached foo' test_expect_success \ 'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' ' - git checkout HEAD -- foo && - echo "other content" > foo && - git add foo && - echo "yet another content" > foo && + prepare_foo content "other content" "yet another content" && 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' \ - 'git checkout HEAD -- foo && - echo "other content" > foo && - git add foo && - echo "yet another content" > foo && + 'prepare_foo content "other content" "yet another content" && git rm --cached -f foo' test_expect_success \
Re: [PATCHv6 07/16] t3600 (rm): add lots of missing &&
Quoted 6 lines · Jonathan Nieder
Maybe you would prefer something like this on top? My only concern is to make sure the test is robust (even if people add new tests before these without paying much attention) and easy to read.
I suppose I am nitpicking excessively because I do not like to see regressions, even in out-of-the-way code like this.
I do not think you are nitpicking at all; it is a key to maintainability to make sure that the code is unlikely to be broken by future changes that are not perfectly diligent.
Thanks.
PATCH v6 8/16 t4019 (diff-wserror): add lots of missing &&
In reply to Elijah NewrenAlso add test_might_fail in front of the git_config --unset commands that may be trying to unset a value that never got set (due to a previous failing test) or that were already unset.
--- t/t4019-diff-wserror.sh | 53 ++++++++++++++++++++++++----------------------- 1 files changed, 27 insertions(+), 26 deletions(-)
t/t4019-diff-wserror.sh +27 -26
@@ -36,11 +36,12 @@ prepare_output () { git diff --color >output $grep_a "$blue_grep" output >error $grep_a -v "$blue_grep" output >normal + return 0 } test_expect_success default ' - prepare_output + prepare_output && grep Eight normal >/dev/null && grep HT error >/dev/null &&
@@ -52,8 +53,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 +66,9 @@ test_expect_success 'without -trail' ' test_expect_success 'without -trail (attribute)' ' - git config --unset core.whitespace - echo "F whitespace=-trail" >.gitattributes - prepare_output + test_might_fail git config --unset core.whitespace && + echo "F whitespace=-trail" >.gitattributes && + prepare_output && grep Eight normal >/dev/null && grep HT error >/dev/null &&
@@ -79,9 +80,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 +94,9 @@ test_expect_success 'without -space' ' test_expect_success 'without -space (attribute)' ' - git config --unset core.whitespace - echo "F whitespace=-space" >.gitattributes - prepare_output + test_might_fail git config --unset core.whitespace && + echo "F whitespace=-space" >.gitattributes && + prepare_output && grep Eight normal >/dev/null && grep HT normal >/dev/null &&
@@ -107,9 +108,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 +122,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 + test_might_fail 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 +136,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 +150,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 + test_might_fail 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 +180,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
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 9/16 t4026 (color): remove unneeded and unchained command
In reply to Elijah NewrenEver 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.
--- t/t4026-color.sh | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
t/t4026-color.sh +0 -1
@@ -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 '
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 10/16 t5602 (clone-remote-exec): add missing &&
In reply to Elijah NewrenAlso add a couple test_must_fail invocations where needed, and avoid one-shot environment variable export and function calls.
--- t/t5602-clone-remote-exec.sh | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-)
t/t5602-clone-remote-exec.sh +15 -7
@@ -5,21 +5,29 @@ 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 && + 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 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 && + 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 '
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 11/16 t6016 (rev-list-graph-simplify-history): add missing &&
In reply to Elijah NewrenAlso move repeated tag and branch deletions into a separate setup test, to avoid failures from tags and branches having already been deleted.
--- t/t6016-rev-list-graph-simplify-history.sh | 29 +++++++++------------------ 1 files changed, 10 insertions(+), 19 deletions(-)
t/t6016-rev-list-graph-simplify-history.sh +10 -19
@@ -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 &&
@@ -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 'setup: get rid of decorations on B' ' + git tag -d B2 && + git tag -d B1 && + git branch -d B +' + +# Graph with branch B 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 echo "* $A7" >> expected && echo "* $A6" >> expected && echo "|\\ " >> expected &&
@@ -143,9 +146,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 +163,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 +178,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 +190,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 &&
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 12/16 t7001 (mv): add missing &&
In reply to Elijah NewrenAlso, prefix an expected-to-fail git mv command with 'test_must_fail'.
--- t/t7001-mv.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
t/t7001-mv.sh +1 -1
@@ -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'
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 13/16 t7601 (merge-pull-config): add missing &&
In reply to Elijah NewrenAlso prefix several relevant git merge commands with 'test_must_fail' to keep the tests passing.
--- t/t7601-merge-pull-config.sh | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
t/t7601-merge-pull-config.sh +6 -6
@@ -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
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 14/16 t7800 (difftool): add missing &&
In reply to Elijah NewrenAlso remove a call to 'git config --unset difftool.prompt', since that is already unset by restore_test_defaults.
--- t/t7800-difftool.sh | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
t/t7800-difftool.sh +6 -6
@@ -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 + test_might_fail git config --unset diff.tool && GIT_DIFF_TOOL=test-tool && export GIT_DIFF_TOOL &&
@@ -166,7 +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' ' - git config --unset difftool.prompt + test_might_fail git config --unset difftool.prompt && git config mergetool.prompt false && diff=$(git difftool branch) &&
@@ -211,7 +211,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 +254,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 '
Signature · 1 line
1.7.3.1.66.gab790
PATCH v6 15/16 Add missing &&'s throughout the testsuite
In reply to Elijah Newren---
Quoted 25 lines
From http://thread.gmane.org/gmane.comp.version-control.git/157827/focus=157897:
Quoted 13 lines · Jonathan Nieder
t/t1509-root-worktree.sh say "auto bare gitdir" · line 236
Quoted 10 lines
t/t1509-root-worktree.sh +2
-2@@ -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 /* &&I'm worried that this would fail:
Quoted 8 lines
$ mkdir foo $ cd foo $ >bar $ mkdir baz $ rm * rm: cannot remove `baz': Is a directory $ echo $? 1
Quoted 1 line
How about replacing the two rm commands with a simple 'rm -rf /*'?
That's what I did in t1509 in this round; comments welcome.
t/t0001-init.sh | 2 +- t/t0003-attributes.sh | 45 ++++++++++++-------------- 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 | 5 +-- 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 | 8 ++-- 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(+), 193 deletions(-)
t/t0001-init.sh +1 -1
@@ -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 )
t/t0003-attributes.sh +21 -24
69 lines not on this page · raw message
t/t0020-crlf.sh +1 -1
@@ -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 &&
t/t0024-crlf-archive.sh +2 -2
@@ -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
t/t0026-eol-config.sh +1 -1
@@ -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 &&
t/t0050-filesystem.sh +3 -3
@@ -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 &&
t/t1000-read-tree-m-3way.sh +1 -1
@@ -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 "
t/t1302-repo-version.sh +1 -1
@@ -39,7 +39,7 @@ test_expect_success 'gitdir selection on unsupported repo' ' ( cd test2 && git config core.repositoryformatversion >../actual - ) + ) && test_cmp expect actual '
t/t1401-symbolic-ref.sh +1 -1
@@ -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
t/t1402-check-ref-format.sh +2 -2
@@ -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 &&
t/t1410-reflog.sh +4 -4
@@ -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 &&
t/t1501-worktree.sh +1 -1
@@ -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 '
t/t1509-root-worktree.sh +2 -3
@@ -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,7 @@ say "auto bare gitdir" # DESTROYYYYY!!!!! test_expect_success 'setup' ' - rm -rf /refs /objects /info /hooks - rm /* + rm -rf /* && cd / && echo "Initialized empty Git repository in /" > expected && git init --bare > result &&
t/t2007-checkout-symlink.sh +1 -1
@@ -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" &&
t/t2016-checkout-patch.sh +1 -1
@@ -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
t/t2050-git-dir-relative.sh +2 -2
@@ -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 &&
t/t2103-update-index-ignore-missing.sh +1 -1
@@ -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 &&
t/t2200-add-update.sh +1 -1
@@ -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 &&
t/t3001-ls-files-others-exclude.sh +1 -1
@@ -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
t/t3050-subprojects-fetch.sh +2 -2
@@ -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"
t/t3203-branch-output.sh +3 -3
@@ -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 '
t/t3307-notes-man.sh +1 -1
@@ -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" &&
t/t3406-rebase-message.sh +3 -3
@@ -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
t/t3408-rebase-multi-line.sh +1 -1
@@ -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 &&
t/t3504-cherry-pick-rerere.sh +2 -2
@@ -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 '
t/t3903-stash.sh +2 -2
@@ -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)"
t/t3904-stash-patch.sh +1 -1
@@ -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
t/t4021-format-patch-numbered.sh +1 -1
@@ -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
t/t4027-diff-submodule.sh +1 -1
@@ -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"
t/t4103-apply-binary.sh +4 -4
@@ -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.
t/t4104-apply-boundary.sh +2 -2
@@ -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
t/t4111-apply-subdir.sh +2 -2
@@ -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"
t/t4119-apply-config.sh +1 -1
@@ -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 &&
t/t4124-apply-ws-rule.sh +2 -2
@@ -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 &&
t/t4127-apply-same-fn.sh +9 -9
@@ -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 &&
t/t4130-apply-criss-cross-rename.sh +1 -1
@@ -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 &&
t/t4133-apply-filenames.sh +3 -3
@@ -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 '
t/t4150-am.sh +1 -1
@@ -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^ &&
t/t5300-pack-object.sh +2 -2
@@ -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 &&
t/t5301-sliding-window.sh +1 -1
@@ -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 &&
t/t5302-pack-index.sh +1 -1
@@ -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 &&
t/t5500-fetch-pack.sh +1 -1
@@ -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
t/t5502-quickfetch.sh +1 -1
@@ -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" &&
t/t5503-tagfollow.sh +2 -2
@@ -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 &&
t/t5510-fetch.sh +1 -1
@@ -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 &&
t/t5516-fetch-push.sh +10 -10
@@ -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" &&
t/t5517-push-mirror.sh +5 -5
@@ -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 ) && (
t/t5519-push-alternates.sh +1 -1
@@ -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
t/t5531-deep-submodule-push.sh +1 -1
@@ -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 && (
t/t5541-http-push.sh +1 -1
@@ -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 &&
t/t5550-http-fetch.sh +2 -4
@@ -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,9 +93,7 @@ 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 - test_cmp exp act + ! grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act ' stop_httpd
t/t5601-clone.sh +3 -3
@@ -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 )
t/t5701-clone-local.sh +4 -4
@@ -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" &&
t/t5705-clone-2gb.sh +1 -1
@@ -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 &&
t/t6009-rev-list-parent.sh +1 -1
@@ -18,7 +18,7 @@ test_expect_success setup ' commit one && - test_tick=$(($test_tick - 2400)) + test_tick=$(($test_tick - 2400)) && commit two && commit three &&
t/t6010-merge-base.sh +1 -1
@@ -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 &&
t/t6022-merge-rename.sh +1 -1
@@ -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" &&
t/t6024-recursive-merge.sh +1 -1
@@ -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 &&
t/t6030-bisect-porcelain.sh +4 -4
@@ -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) '
t/t6040-tracking-info.sh +1 -1
@@ -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 '
t/t7004-tag.sh +7 -7
@@ -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 '
t/t7105-reset-patch.sh +3 -3
@@ -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
t/t7300-clean.sh +4 -4
@@ -179,11 +179,11 @@ test_expect_success 'git clean -d with prefix and path' ' ' -test_expect_success 'git clean symbolic link' ' +test_expect_success SYMLINKS '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 ) &&
t/t7501-commit.sh +1 -1
@@ -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
t/t7502-commit.sh +1 -1
@@ -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 '
t/t7506-status-submodule.sh +1 -1
@@ -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) &&
t/t7600-merge.sh +1 -1
@@ -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 '
t/t7610-mergetool.sh +1 -1
@@ -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 ) &&
t/t7700-repack.sh +1 -1
@@ -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) &&
t/t8003-blame.sh +3 -3
@@ -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:` - cat >badcommit <<EOF + TREE=`git rev-parse HEAD:` && + cat >badcommit <<EOF && tree $TREE author <noname> 1234567890 +0000 committer David Reiss <[email protected]> 1234567890 +0000 some message EOF - COMMIT=`git hash-object -t commit -w badcommit` + COMMIT=`git hash-object -t commit -w badcommit` && git --no-pager blame $COMMIT -- uno >/dev/null '
t/t9122-git-svn-author.sh +2 -2
@@ -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 ) '
t/t9123-git-svn-rebuild-with-rewriteroot.sh +1 -1
@@ -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} '
t/t9134-git-svn-ignore-paths.sh +3 -3
@@ -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"
t/t9137-git-svn-dcommit-clobber-series.sh +1 -1
@@ -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" &&
t/t9138-git-svn-authors-prog.sh +3 -3
@@ -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> " )
t/t9146-git-svn-empty-dirs.sh +3 -3
@@ -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 "! !"
t/t9151-svn-mergeinfo.sh +11 -11
@@ -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" ] '
t/t9200-git-cvsexportcommit.sh +2 -2
@@ -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 )'
t/t9401-git-cvsserver-crlf.sh +1 -1
@@ -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 &&
t/t9600-cvsimport.sh +1 -1
@@ -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 '
Signature · 1 line
1.7.3.1.66.gab790
Re: [PATCHv6 15/16] Add missing &&'s throughout the testsuite
Quoted 12 lines · Elijah Newren
Quoted 12 lines · Jonathan Nieder
Quoted 11 lines
Quoted 11 lines
t/t1509-root-worktree.sh +2
-2@@ -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 /* &&
[...]
Quoted 1 line
Quoted 1 line
How about replacing the two rm commands with a simple 'rm -rf /*'?
Umm, won't that delete _everything_, including git?
I would suggest just leaving the test alone and contacting the test author or adding a comment unless you can test the change.
Re: [PATCHv6 15/16] Add missing &&'s throughout the testsuite
In reply to Elijah Newrent/t5550-http-fetch.sh test_expect_success 'fetch notices corrupt idx' ' · line 96
Quoted 9 lines · Elijah Newren
+++
b/t/t5550-http-fetch.sht/t5550-http-fetch.sh +1
-3@@ -93,9 +93,7 @@ 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 - test_cmp exp act + ! grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act
Wait a moment: this writes its output to act instead of stdout, so one still does _not_ get to see the output when debugging with -v.
Probably the nontrivial changes (this one and adding a SYMLINKS prereq) should be split off as separate patches or mentioned in the log message?
Pro tip: if all that remains is tiny tweaks like these, you can probably ask Junio to amend instead of resending everything. :)
PATCH v6 16/16 Introduce portable_unset and use it to ensure proper && chaining
In reply to Elijah Newren--- t/README | 13 +++++-------- t/t0001-init.sh | 28 ++++++++++++++-------------- t/t7006-pager.sh | 10 +++++----- t/t7502-commit.sh | 4 ++-- t/test-lib.sh | 11 +++++++++++ 5 files changed, 37 insertions(+), 29 deletions(-)
t/README +5 -8
@@ -259,14 +259,11 @@ Do: test ... That way all of the commands in your tests will succeed or fail. If - you must ignore the return value of something (e.g., the return - after unsetting a variable that was already unset is unportable) it's - best to indicate so explicitly with a semicolon: - - unset HLAGH; - git merge hla && - git push gh && - test ... + you must ignore the return value of something, consider using a + helper function (e.g. use portable_unset instead of unset, in order + to avoid unportable return value for unsetting a variable that was + already unset), or prepending the command with test_might_fail or + test_must_fail. - Check the test coverage for your tests. See the "Test coverage" below.
t/t0001-init.sh +14 -14
@@ -25,7 +25,7 @@ check_config () { test_expect_success 'plain' ' ( - unset GIT_DIR GIT_WORK_TREE + portable_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 + portable_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 + portable_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 + portable_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 + portable_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 + portable_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 + portable_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 + portable_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 + portable_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 + portable_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 && + portable_unset GIT_CONFIG_NOGLOBAL && + portable_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 && + portable_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 && + portable_unset GIT_CONFIG_NOGLOBAL && git config -f "$test_config" core.sharedRepository 0666 && mkdir shared-honor-global && cd shared-honor-global &&
t/t7006-pager.sh +5 -5
@@ -41,7 +41,7 @@ else fi test_expect_success 'setup' ' - unset GIT_PAGER GIT_PAGER_IN_USE; + portable_unset GIT_PAGER GIT_PAGER_IN_USE && test_might_fail git config --unset core.pager && PAGER="cat >paginated.out" &&
@@ -254,7 +254,7 @@ test_default_pager() { parse_args "$@" $test_expectation SIMPLEPAGERTTY "$cmd - default pager is used by default" " - unset PAGER GIT_PAGER; + portable_unset PAGER GIT_PAGER && test_might_fail git config --unset core.pager && rm -f default_pager_used || cleanup_fail &&
@@ -277,7 +277,7 @@ test_PAGER_overrides() { parse_args "$@" $test_expectation TTY "$cmd - PAGER overrides default pager" " - unset GIT_PAGER; + portable_unset GIT_PAGER && test_might_fail git config --unset core.pager && rm -f PAGER_used || cleanup_fail &&
@@ -305,7 +305,7 @@ test_core_pager() { parse_args "$@" $test_expectation TTY "$cmd - repository-local core.pager setting $used_if_wanted" " - unset GIT_PAGER; + portable_unset GIT_PAGER && rm -f core.pager_used || cleanup_fail &&
@@ -333,7 +333,7 @@ test_pager_subdir_helper() { parse_args "$@" $test_expectation TTY "$cmd - core.pager $used_if_wanted from subdirectory" " - unset GIT_PAGER; + portable_unset GIT_PAGER && rm -f core.pager_used && rm -fr sub || cleanup_fail &&
t/t7502-commit.sh +2 -2
@@ -252,8 +252,8 @@ test_expect_success 'committer is automatic' ' echo >>negative && ( - unset GIT_COMMITTER_EMAIL - unset GIT_COMMITTER_NAME + portable_unset GIT_COMMITTER_EMAIL && + portable_unset GIT_COMMITTER_NAME && # must fail because there is no change test_must_fail git commit -e -m "sample" ) &&
t/test-lib.sh +11 -0
@@ -268,6 +268,17 @@ remove_cr () { tr '\015' Q | sed -e 's/Q$//' } +# In some bourne shell implementations, the "unset" builtin returns +# nonzero status when a variable to be unset was not set in the first +# place. +# +# Use portable_unset when that should not be considered an error. + +portable_unset () { + unset "$@" + return 0 +} + test_tick () { if test -z "${test_tick+set}" then
Signature · 1 line
1.7.3.1.66.gab790
Re: [PATCHv6 16/16] Introduce portable_unset and use it to ensure proper && chaining
Quoted 17 lines · Elijah Newren
Reviewed-by Jonathan Nieder <[email protected]>Signed-off-by Elijah Newren <[email protected]>---
t/README | 13 +++++--------t/t0001-init.sh| 28 ++++++++++++++--------------t/t7006-pager.sh| 10 +++++-----t/t7502-commit.sh| 4 ++--
t/test-lib.sh | 11 +++++++++++5 files changed, 37 insertions(+), 29 deletions(-)t/README +0
-0@@ -259,14 +259,11 @@ Do:test ...
Quoted 14 lines
That way all of the commands in your tests will succeed or fail. If
- you must ignore the return value of something (e.g., the return
- after unsetting a variable that was already unset is unportable) it's
- best to indicate so explicitly with a semicolon:
-
- unset HLAGH;
- git merge hla &&
- git push gh &&
- test ...
+ you must ignore the return value of something, consider using a
+ helper function (e.g. useportable_unsetinstead of unset, in order
+ to avoid unportable return value for unsetting a variable that was
+ already unset), or prepending the command withtest_might_failor
+test_must_fail.
This should be:
diff --git a/t/README b/t/README
index a1eb7c8..dc4b9d1 100644
--- a/t/README
+++ b/t/README
@@ -259,11 +259,10 @@ Do:
test ...
That way all of the commands in your tests will succeed or fail. If
- you must ignore the return value of something (e.g., the return
- after unsetting a variable that was already unset is unportable) it's
- best to indicate so explicitly with a semicolon:
+ you must ignore the return value of something it's best to indicate
+ so explicitly with a test_might_fail:
- unset HLAGH;
+ test_might_fail some-command &&
git merge hla &&
git push gh &&
test ...
@@ -522,6 +521,10 @@ library for your script to use.
...
'
+ - portable_unset <variable>
+
+ .....
+
Prerequisites
-------------Or something like that. I don't know if we came to an agreement on using test_might_fail for non-builtins, but the docs on do's & dont's should mention how to do that, and portable_unset should be documented in a new section in "Test harness library".
Re: [PATCHv6 16/16] Introduce portable_unset and use it to ensure proper && chaining
Quoted 2 lines · Ævar Arnfjörð Bjarmason
I don't know if we came to an agreement on
usingtest_might_failfor non-builtins
Non-builtins: okay.
Non-git commands: no.
That's just my take, though; if the project consensus is different, who am I to resist it?
Quoted 2 lines
but the docs on do's & dont's
should mention how to do that
Is it common to need to do
{
grep dontknowifitwillmatch file >result ||
true
}for commands other than unset? If so, then I guess we should adopt Sverre's cmd_might_fail to make it less noisy, anyway.
Quoted 2 lines
and
portable_unsetshould be documented
in a new section in "Test harness library".
Yes, that sounds good.
Re: [PATCHv6 16/16] Introduce portable_unset and use it to ensure proper && chaining
Quoted 10 lines · Jonathan Nieder
Quoted 2 lines · Ævar Arnfjörð Bjarmason
I don't know if we came to an agreement on
usingtest_might_failfor non-builtinsNon-builtins: okay.
Non-git commands: no.That's just my take, though; if the project consensus is different, who am I to resist it?
Hmm, the pros and cons between allowing test_might_fail on normal commands vs introducing cmd_might_fail are questionable, though. I cannot think of a case where we would want to tolerate death by signal or segv on non git commands by using cmd_might_fail. At least I do not think that is a common thing we would want to ignore, and in a rare case, it probably is a good idea to say that explicitly with something like...
{
frotz
: the above might randomly segfault but we do not care
}Re: [PATCHv6 16/16] Introduce portable_unset and use it to ensure proper && chaining
Quoted 4 lines · Junio C Hamano
Hmm, the pros and cons between allowing
test_might_failon normal commands vs introducingcmd_might_failare questionable, though. I cannot think of a case where we would want to tolerate death by signal or segv on non git commands
Okay, makes sense. I would be happier if exit statuses 129 and 129-256 were disallowed by test_must_fail, too, but that does not make it any less useful for cases like "test_might_fail grep needle haystack >result". And it is better to avoid introducing yet another command to learn.
Quoted 1 line · Elijah Newren
This patch series fixes many of the missing &&s in the testsuite.
[...]
Quoted 1 line
100 files changed, 429 insertions(+), 418 deletions(-)
Thanks for your persistence, and sorry to nitpick so.
With the exception of patches 7 and 15 as already mentioned, this looks ready to me.
Quoted 4 lines · Elijah Newren
* In patch 1, I made two of the changes suggested by Jonathan, but this was Ævar's patch so he may want to comment on those. Also, Jonathan had a few extra questions in the last round that perhaps Ævar may want to comment on.
Since Jonathan says all but 7 & 15 are OK (and I looked at those) I assume I don't need to hunt down some other discussion and comment on that. I.e. unless someone replies here.
Hi Ævar,
Quoted 3 lines · Ævar Arnfjörð Bjarmason
Since Jonathan says all but 7 & 15 are OK (and I looked at those) I assume I don't need to hunt down some other discussion and comment on that. I.e. unless someone replies here.
If you find time, it would be nice to take a look at
http://thread.gmane.org/gmane.comp.version-control.git/157827/focus=157874
(concerning patch 1/16), to consider quoting issues.
Because of all the nested quoting (and funny indentation, too), I found the test hard to read. Probably the best long-term solution would be to use something like the style[1] notmuch’s test suite uses.
I can only see problems coming from this if the path to the test directory has shell metacharacters (especially '$') in it, which would seem to me to be a pretty unusual setup.
[1] or as Jeff suggested recently:
test_start 'setup'
cat >expect <<EOF
... whatever ...
EOFtest_end success
test_start 'description'
git frob >actual &&test_cmp expect actualtest_end success
http://thread.gmane.org/gmane.comp.version-control.git/155596/focus=155681
Quoted 11 lines · Jonathan Nieder
Hi Ævar,
Quoted 3 lines · Ævar Arnfjörð Bjarmason
Since Jonathan says all but 7 & 15 are OK (and I looked at those) I assume I don't need to hunt down some other discussion and comment on that. I.e. unless someone replies here.
If you find time, it would be nice to take a look at
http://thread.gmane.org/gmane.comp.version-control.git/157827/focus=157874
(concerning patch 1/16), to consider quoting issues.
Ah thanks. I just noticed that after having written that mail and replied to it.
PATCH 1/1 test-lib: &&-chaining tester
In reply to Elijah Newren---
Hi Elijah,
Quoted 1 line · Elijah Newren
This patch series fixes many of the missing &&s in the testsuite.
Thanks again. Here's a little glimpse of a future without missing &&s to play with.
t/test-lib.sh | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
t/test-lib.sh +11 -0
@@ -393,7 +393,17 @@ test_debug () { test "$debug" = "" || eval "$1" } +check_command_chaining_ () { + eval >&3 2>&4 "(exit 189) && $1" + eval_chain_ret=$? + if test "$eval_chain_ret" != 189 + then + error 'bug in the test script: missing "&&" in test commands' + fi +} + test_run_ () { + check_command_chaining_ "$1" test_cleanup=: eval >&3 2>&4 "$1" eval_ret=$?
@@ -697,6 +707,7 @@ test_cmp() { # the test to pass. test_when_finished () { + check_command_chaining_ "$test_cleanup" test_cleanup="{ $* } && (exit \"\$eval_ret\"); eval_ret=\$?; $test_cleanup" }
Signature · 1 line
1.7.2.3
Re: [TOY PATCH] test-lib: &&-chaining tester
Heya,
Quoted 2 lines · Jonathan Nieder
Thanks again. Here's a little glimpse of a future without missing &&s to play with.
Interesting! Are there any false positives? Did you run it and find any missing &&'s?
Signature · 3 lines
Cheers, Sverre Rabbelier
Re: [TOY PATCH] test-lib: &&-chaining tester
In reply to Jonathan NiederQuoted 6 lines · Jonathan Nieder
Quoted 1 line · Elijah Newren
This patch series fixes many of the missing &&s in the testsuite.
Thanks again. Here's a little glimpse of a future without missing &&s to play with.
Probably a silly question, but is there any reason why we use these && instead of a "set -e" once and for all?
Signature · 2 lines
Matthieu Moy http://www-verimag.imag.fr/~moy/
Re: [TOY PATCH] test-lib: &&-chaining tester
Am 10/6/2010 10:09, schrieb Matthieu Moy:
Quoted 2 lines
Probably a silly question, but is there any reason why we use these && instead of a "set -e" once and for all?
Because different shells implement different behavior when "set -e" is in effect and functions, && and || chains, and traps are in the game.
-- Hannes
PATCH 1/1 tests: add missing &&
In reply to Elijah NewrenBreaks in a test assertion's && chain can potentially hide failures from earlier commands in the chain.
Commands intended to fail should be marked with !, test_must_fail, or test_might_fail. The examples in this patch do not require that.
---
Hi,
Just found some time to work through reports from the && checker. The examples below only add && to the end of lines in various tests. Passes all tests there (though of course that does not mean much).
Thoughts?
Jonathan
t/annotate-tests.sh | 2 +- t/t0003-attributes.sh | 2 +- t/t0024-crlf-archive.sh | 4 ++-- t/t0026-eol-config.sh | 2 +- t/t0050-filesystem.sh | 12 ++++++------ t/t1000-read-tree-m-3way.sh | 2 +- t/t1001-read-tree-m-2way.sh | 2 +- t/t1011-read-tree-sparse-checkout.sh | 2 +- t/t1200-tutorial.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/t1450-fsck.sh | 4 ++-- t/t2007-checkout-symlink.sh | 2 +- t/t2016-checkout-patch.sh | 2 +- t/t2017-checkout-orphan.sh | 2 +- t/t2050-git-dir-relative.sh | 4 ++-- t/t2101-update-index-reupdate.sh | 2 +- t/t2200-add-update.sh | 2 +- t/t3001-ls-files-others-exclude.sh | 2 +- t/t3030-merge-recursive.sh | 2 +- t/t3050-subprojects-fetch.sh | 4 ++-- t/t3203-branch-output.sh | 6 +++--- t/t3300-funny-names.sh | 8 ++++---- t/t3307-notes-man.sh | 2 +- t/t3406-rebase-message.sh | 6 +++--- t/t3408-rebase-multi-line.sh | 2 +- t/t3412-rebase-root.sh | 4 ++-- t/t3415-rebase-autosquash.sh | 6 +++--- t/t3417-rebase-whitespace-fix.sh | 2 +- t/t3504-cherry-pick-rerere.sh | 4 ++-- t/t3902-quoted.sh | 6 +++--- t/t3903-stash.sh | 6 +++--- t/t3904-stash-patch.sh | 2 +- t/t4008-diff-break-rewrite.sh | 2 +- t/t4015-diff-whitespace.sh | 2 +- t/t4021-format-patch-numbered.sh | 2 +- t/t4027-diff-submodule.sh | 8 ++++---- t/t4034-diff-words.sh | 4 ++-- t/t4103-apply-binary.sh | 8 ++++---- t/t4111-apply-subdir.sh | 4 ++-- t/t4119-apply-config.sh | 2 +- t/t4127-apply-same-fn.sh | 18 +++++++++--------- t/t4130-apply-criss-cross-rename.sh | 2 +- t/t4133-apply-filenames.sh | 8 ++++---- t/t4134-apply-submodule.sh | 2 +- t/t4150-am.sh | 2 +- t/t4201-shortlog.sh | 2 +- t/t4202-log.sh | 4 ++-- t/t4252-am-options.sh | 2 +- t/t5300-pack-object.sh | 2 +- t/t5301-sliding-window.sh | 4 ++-- t/t5302-pack-index.sh | 2 +- t/t5500-fetch-pack.sh | 2 +- t/t5502-quickfetch.sh | 2 +- t/t5510-fetch.sh | 2 +- t/t5514-fetch-multiple.sh | 2 +- t/t5516-fetch-push.sh | 8 ++++---- t/t5519-push-alternates.sh | 2 +- t/t5531-deep-submodule-push.sh | 2 +- t/t556x_common | 24 ++++++++++++------------ t/t6001-rev-list-graft.sh | 8 ++++---- t/t6009-rev-list-parent.sh | 2 +- t/t6010-merge-base.sh | 2 +- t/t6024-recursive-merge.sh | 2 +- t/t6029-merge-subtree.sh | 2 +- t/t6030-bisect-porcelain.sh | 8 ++++---- t/t6036-recursive-corner-cases.sh | 2 +- t/t6040-tracking-info.sh | 2 +- t/t6050-replace.sh | 2 +- t/t7105-reset-patch.sh | 6 +++--- t/t7509-commit.sh | 2 +- t/t7602-merge-octopus-many.sh | 2 +- t/t7610-mergetool.sh | 2 +- t/t7810-grep.sh | 4 ++-- t/t9104-git-svn-follow-parent.sh | 2 +- t/t9123-git-svn-rebuild-with-rewriteroot.sh | 2 +- t/t9124-git-svn-dcommit-auto-props.sh | 2 +- t/t9151-svn-mergeinfo.sh | 22 +++++++++++----------- t/t9300-fast-import.sh | 2 +- t/t9350-fast-export.sh | 2 +- t/t9400-git-cvsserver-server.sh | 2 +- t/t9401-git-cvsserver-crlf.sh | 2 +- 84 files changed, 166 insertions(+), 166 deletions(-)
t/annotate-tests.sh +1 -1
@@ -38,7 +38,7 @@ test_expect_success \ 'prepare reference tree' \ 'echo "1A quick brown fox jumps over the" >file && echo "lazy dog" >>file && - git add file + git add file && GIT_AUTHOR_NAME="A" git commit -a -m "Initial."' test_expect_success \
t/t0003-attributes.sh +1 -1
@@ -59,7 +59,7 @@ test_expect_success 'attribute test' ' test_expect_success 'attribute test: read paths from stdin' ' - cat <<EOF > expect + cat <<EOF > expect && f: test: f a/f: test: f a/c/f: test: f
t/t0024-crlf-archive.sh +2 -2
@@ -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
t/t0026-eol-config.sh +1 -1
@@ -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 &&
t/t0050-filesystem.sh +6 -6
@@ -12,14 +12,14 @@ 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 && if test "$(cat junk/CamelCase)" != good then - test_case=test_expect_failure + test_case=test_expect_failure && case_insensitive=t fi && rm -fr junk &&
@@ -27,7 +27,7 @@ test_expect_success 'see what we expect' ' >junk/"$auml" && case "$(cd junk && echo *)" in "$aumlcdiar") - test_unicode=test_expect_failure + test_unicode=test_expect_failure && unibad=t ;; *) ;;
@@ -36,7 +36,7 @@ test_expect_success 'see what we expect' ' { ln -s x y 2> /dev/null && test -h y 2> /dev/null || - no_symlinks=1 + no_symlinks=1 && rm -f y } '
@@ -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 &&
t/t1000-read-tree-m-3way.sh +1 -1
@@ -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 "
t/t1001-read-tree-m-2way.sh +1 -1
@@ -394,7 +394,7 @@ test_expect_success '-m references the correct modified tree' ' echo >file-a && echo >file-b && git add file-a file-b && - git commit -a -m "test for correct modified tree" + git commit -a -m "test for correct modified tree" && git branch initial-mod && echo b >file-b && git commit -a -m "B" &&
t/t1011-read-tree-sparse-checkout.sh +1 -1
@@ -47,7 +47,7 @@ test_expect_success 'read-tree without .git/info/sparse-checkout' ' ' test_expect_success 'read-tree with .git/info/sparse-checkout but disabled' ' - echo >.git/info/sparse-checkout + echo >.git/info/sparse-checkout && git read-tree -m -u HEAD && git ls-files -t >result && test_cmp expected.swt result &&
t/t1200-tutorial.sh +1 -1
@@ -42,7 +42,7 @@ test_expect_success 'git diff' ' ' test_expect_success 'tree' ' - tree=$(git write-tree 2>/dev/null) + tree=$(git write-tree 2>/dev/null) && test 8988da15d077d4829fc51d8544c097def6644dbb = $tree '
t/t1302-repo-version.sh +1 -1
@@ -39,7 +39,7 @@ test_expect_success 'gitdir selection on unsupported repo' ' ( cd test2 && git config core.repositoryformatversion >../actual - ) + ) && test_cmp expect actual '
t/t1401-symbolic-ref.sh +1 -1
@@ -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
t/t1402-check-ref-format.sh +2 -2
@@ -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 &&
t/t1410-reflog.sh +4 -4
@@ -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 &&
t/t1450-fsck.sh +2 -2
@@ -61,7 +61,7 @@ test_expect_success 'object with bad sha1' ' sha=$(echo blob | git hash-object -w --stdin) && old=$(echo $sha | sed "s+^..+&/+") && new=$(dirname $old)/ffffffffffffffffffffffffffffffffffffff && - sha="$(dirname $new)$(basename $new)" + sha="$(dirname $new)$(basename $new)" && mv .git/objects/$old .git/objects/$new && test_when_finished "remove_object $sha" && git update-index --add --cacheinfo 100644 $sha foo &&
@@ -111,7 +111,7 @@ test_expect_success 'email with embedded > is not okay' ' ' test_expect_success 'tag pointing to nonexistent' ' - cat >invalid-tag <<-\EOF + cat >invalid-tag <<-\EOF && object ffffffffffffffffffffffffffffffffffffffff type commit tag invalid
t/t2007-checkout-symlink.sh +1 -1
@@ -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" &&
t/t2016-checkout-patch.sh +1 -1
@@ -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
t/t2017-checkout-orphan.sh +1 -1
@@ -14,7 +14,7 @@ TEST_FILE=foo test_expect_success 'Setup' ' echo "Initial" >"$TEST_FILE" && git add "$TEST_FILE" && - git commit -m "First Commit" + git commit -m "First Commit" && test_tick && echo "State 1" >>"$TEST_FILE" && git add "$TEST_FILE" &&
t/t2050-git-dir-relative.sh +2 -2
@@ -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 &&
t/t2101-update-index-reupdate.sh +1 -1
@@ -51,7 +51,7 @@ test_expect_success 'update-index again' \ echo hello world >dir1/file3 && echo goodbye people >file2 && git update-index --add file2 dir1/file3 && - echo hello everybody >file2 + echo hello everybody >file2 && echo happy >dir1/file3 && git update-index --again && git ls-files -s >current &&
t/t2200-add-update.sh +1 -1
@@ -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 &&
t/t3001-ls-files-others-exclude.sh +1 -1
@@ -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
t/t3030-merge-recursive.sh +1 -1
@@ -544,7 +544,7 @@ test_expect_success 'reset and bind merge' ' echo "100644 $o0 0 c" echo "100644 $o1 0 d/e" ) >expected && - test_cmp expected actual + test_cmp expected actual && git read-tree --prefix=z/ master && git ls-files -s >actual &&
t/t3050-subprojects-fetch.sh +2 -2
@@ -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"
t/t3203-branch-output.sh +3 -3
@@ -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 '
t/t3300-funny-names.sh +4 -4
@@ -43,8 +43,8 @@ test_expect_success TABS_IN_FILENAMES 'git ls-files no-funny' \ test_cmp expected current' test_expect_success TABS_IN_FILENAMES 'setup expect' ' -t0=`git write-tree` -echo "$t0" >t0 +t0=`git write-tree` && +echo "$t0" >t0 && cat > expected <<\EOF just space
@@ -69,8 +69,8 @@ test_expect_success TABS_IN_FILENAMES 'git ls-files -z with-funny' \ test_cmp expected current' test_expect_success TABS_IN_FILENAMES 'setup expect' ' -t1=`git write-tree` -echo "$t1" >t1 +t1=`git write-tree` && +echo "$t1" >t1 && cat > expected <<\EOF just space
t/t3307-notes-man.sh +1 -1
@@ -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" &&
t/t3406-rebase-message.sh +3 -3
@@ -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
t/t3408-rebase-multi-line.sh +1 -1
@@ -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 &&
t/t3412-rebase-root.sh +2 -2
@@ -173,14 +173,14 @@ EOF test_expect_success 'pre-rebase hook stops rebase' ' git checkout -b stops1 other && test_must_fail git rebase --root --onto master && - test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops1 + test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops1 && test 0 = $(git rev-list other...stops1 | wc -l) ' test_expect_success 'pre-rebase hook stops rebase -i' ' git checkout -b stops2 other && test_must_fail git rebase --root --onto master && - test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops2 + test "z$(git symbolic-ref HEAD)" = zrefs/heads/stops2 && test 0 = $(git rev-list other...stops2 | wc -l) '
t/t3415-rebase-autosquash.sh +3 -3
@@ -26,7 +26,7 @@ test_auto_fixup() { echo 1 >file1 && git add -u && test_tick && - git commit -m "fixup! first" + git commit -m "fixup! first" && git tag $1 && test_tick &&
@@ -55,7 +55,7 @@ test_auto_squash() { echo 1 >file1 && git add -u && test_tick && - git commit -m "squash! first" + git commit -m "squash! first" && git tag $1 && test_tick &&
@@ -84,7 +84,7 @@ test_expect_success 'misspelled auto squash' ' echo 1 >file1 && git add -u && test_tick && - git commit -m "squash! forst" + git commit -m "squash! forst" && git tag final-missquash && test_tick && git rebase --autosquash -i HEAD^^^ &&
t/t3417-rebase-whitespace-fix.sh +1 -1
@@ -89,7 +89,7 @@ test_expect_success 'same, but do not remove trailing spaces' ' git config core.whitespace "-blank-at-eol" && git reset --hard HEAD^ && cp third file && git add file && git commit -m third && - git rebase --whitespace=fix HEAD^^ + git rebase --whitespace=fix HEAD^^ && git diff --exit-code HEAD^:file expect-second && test_cmp file third '
t/t3504-cherry-pick-rerere.sh +2 -2
@@ -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 '
t/t3902-quoted.sh +3 -3
@@ -36,19 +36,19 @@ for_each_name () { test_expect_success TABS_IN_FILENAMES 'setup' ' mkdir "$FN" && - for_each_name "echo initial >\"\$name\"" + for_each_name "echo initial >\"\$name\"" && git add . && git commit -q -m Initial && for_each_name "echo second >\"\$name\"" && - git commit -a -m Second + git commit -a -m Second && for_each_name "echo modified >\"\$name\"" ' test_expect_success TABS_IN_FILENAMES 'setup expected files' ' -cat >expect.quoted <<\EOF +cat >expect.quoted <<\EOF && Name "Name and a\nLF" "Name and an\tHT"
t/t3903-stash.sh +3 -3
@@ -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 &&
@@ -255,7 +255,7 @@ test_expect_success 'stash rm and ignore' ' echo file >.gitignore && git stash save "rm and ignore" && test bar = "$(cat file)" && - test file = "$(cat .gitignore)" + test file = "$(cat .gitignore)" && git stash apply && ! test -r file && test file = "$(cat .gitignore)"
@@ -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)"
t/t3904-stash-patch.sh +1 -1
@@ -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
t/t4008-diff-break-rewrite.sh +1 -1
@@ -155,7 +155,7 @@ test_expect_success \ git checkout-index -f -u -a && sed -e "s/git/GIT/" file0 >file1 && sed -e "s/git/GET/" file0 >file2 && - rm -f file0 + rm -f file0 && git update-index --add --remove file0 file1 file2' test_expect_success \
t/t4015-diff-whitespace.sh +1 -1
@@ -330,7 +330,7 @@ test_expect_success 'check space before tab in indent (space-before-tab: on)' ' test_expect_success 'check spaces as indentation (indent-with-non-tab: off)' ' - git config core.whitespace "-indent-with-non-tab" + git config core.whitespace "-indent-with-non-tab" && echo " foo ();" > x && git diff --check
t/t4021-format-patch-numbered.sh +1 -1
@@ -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
t/t4027-diff-submodule.sh +4 -4
@@ -316,11 +316,11 @@ 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" - echo "160000 2$c 2 sub" + echo "000000 $_z40 0 sub" && + echo "160000 1$c 1 sub" && + echo "160000 2$c 2 sub" && echo "160000 3$c 3 sub" ) | git update-index --index-info && echo >expect.nosub '\''diff --cc sub
t/t4034-diff-words.sh +2 -2
@@ -6,8 +6,8 @@ test_description='word diff colors' test_expect_success setup ' - git config diff.color.old red - git config diff.color.new green + git config diff.color.old red && + git config diff.color.new green && git config diff.color.func magenta '
t/t4103-apply-binary.sh +4 -4
@@ -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.
t/t4111-apply-subdir.sh +2 -2
@@ -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"
t/t4119-apply-config.sh +1 -1
@@ -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 &&
t/t4127-apply-same-fn.sh +9 -9
@@ -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 &&
t/t4130-apply-criss-cross-rename.sh +1 -1
@@ -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 &&
t/t4133-apply-filenames.sh +4 -4
@@ -8,7 +8,7 @@ test_description='git apply filename consistency check' . ./test-lib.sh test_expect_success setup ' - cat > bad1.patch <<EOF + cat > bad1.patch <<EOF && diff --git a/f b/f new file mode 100644 index 0000000..d00491f
@@ -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 '
t/t4134-apply-submodule.sh +1 -1
@@ -8,7 +8,7 @@ test_description='git apply submodule tests' . ./test-lib.sh test_expect_success setup ' - cat > create-sm.patch <<EOF + cat > create-sm.patch <<EOF && diff --git a/dir/sm b/dir/sm new file mode 160000 index 0000000..0123456
t/t4150-am.sh +1 -1
@@ -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^ &&
t/t4201-shortlog.sh +1 -1
@@ -35,7 +35,7 @@ test_expect_success 'setup' ' tr 1234 "\370\235\204\236")" a1 && echo 5 >a1 && - git commit --quiet -m "a 12 34 56 78" a1 + git commit --quiet -m "a 12 34 56 78" a1 && echo 6 >a1 && git commit --quiet -m "Commit by someone else" \
t/t4202-log.sh +2 -2
@@ -191,7 +191,7 @@ test_expect_success 'git show <commits> leaves list of commits as given' ' test_expect_success 'setup case sensitivity tests' ' echo case >one && test_tick && - git add one + git add one && git commit -a -m Second '
@@ -341,7 +341,7 @@ test_expect_success 'set up more tangled history' ' test_commit octopus-b && git checkout master && test_commit seventh && - git merge octopus-a octopus-b + git merge octopus-a octopus-b && git merge reach '
t/t4252-am-options.sh +1 -1
@@ -59,7 +59,7 @@ test_expect_success 'interrupted am --directory="frotz nitfol"' ' ' test_expect_success 'apply to a funny path' ' - with_sq="with'\''sq" + with_sq="with'\''sq" && rm -fr .git/rebase-apply && git reset --hard initial && git am --directory="$with_sq" "$tm"/am-test-5-2 &&
t/t5300-pack-object.sh +1 -1
@@ -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 &&
t/t5301-sliding-window.sh +2 -2
@@ -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 &&
@@ -48,7 +48,7 @@ test_expect_success \ git repack -a -d && test "`git count-objects`" = "0 objects, 0 kilobytes" && pack2=`ls .git/objects/pack/*.pack` && - test -f "$pack2" + test -f "$pack2" && test "$pack1" \!= "$pack2"' test_expect_success \
t/t5302-pack-index.sh +1 -1
@@ -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 &&
t/t5500-fetch-pack.sh +1 -1
@@ -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
t/t5502-quickfetch.sh +1 -1
@@ -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" &&
t/t5510-fetch.sh +1 -1
@@ -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 &&
t/t5514-fetch-multiple.sh +1 -1
@@ -27,7 +27,7 @@ test_expect_success setup ' ( cd two && git branch another ) && - git clone --mirror two three + git clone --mirror two three && git clone one test '
t/t5516-fetch-push.sh +4 -4
@@ -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 &&
t/t5519-push-alternates.sh +1 -1
@@ -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
t/t5531-deep-submodule-push.sh +1 -1
@@ -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 && (
t/t556x_common +12 -12
@@ -52,21 +52,21 @@ get_static_files() { SMART=smart export GIT_HTTP_EXPORT_ALL=1 test_expect_success 'direct refs/heads/master not found' ' - log_div "refs/heads/master" + log_div "refs/heads/master" && GET refs/heads/master "404 Not Found" ' test_expect_success 'static file is ok' ' - log_div "getanyfile default" + log_div "getanyfile default" && get_static_files "200 OK" ' SMART=smart_noexport unset GIT_HTTP_EXPORT_ALL test_expect_success 'no export by default' ' - log_div "no git-daemon-export-ok" + log_div "no git-daemon-export-ok" && get_static_files "404 Not Found" ' test_expect_success 'export if git-daemon-export-ok' ' - log_div "git-daemon-export-ok" + log_div "git-daemon-export-ok" && (cd "$HTTPD_DOCUMENT_ROOT_PATH/repo.git" && touch git-daemon-export-ok ) &&
@@ -75,47 +75,47 @@ test_expect_success 'export if git-daemon-export-ok' ' SMART=smart export GIT_HTTP_EXPORT_ALL=1 test_expect_success 'static file if http.getanyfile true is ok' ' - log_div "getanyfile true" + log_div "getanyfile true" && config http.getanyfile true && get_static_files "200 OK" ' test_expect_success 'static file if http.getanyfile false fails' ' - log_div "getanyfile false" + log_div "getanyfile false" && config http.getanyfile false && get_static_files "403 Forbidden" ' test_expect_success 'http.uploadpack default enabled' ' - log_div "uploadpack default" + log_div "uploadpack default" && GET info/refs?service=git-upload-pack "200 OK" && POST git-upload-pack 0000 "200 OK" ' test_expect_success 'http.uploadpack true' ' - log_div "uploadpack true" + log_div "uploadpack true" && config http.uploadpack true && GET info/refs?service=git-upload-pack "200 OK" && POST git-upload-pack 0000 "200 OK" ' test_expect_success 'http.uploadpack false' ' - log_div "uploadpack false" + log_div "uploadpack false" && config http.uploadpack false && GET info/refs?service=git-upload-pack "403 Forbidden" && POST git-upload-pack 0000 "403 Forbidden" ' test_expect_success 'http.receivepack default disabled' ' - log_div "receivepack default" + log_div "receivepack default" && GET info/refs?service=git-receive-pack "403 Forbidden" && POST git-receive-pack 0000 "403 Forbidden" ' test_expect_success 'http.receivepack true' ' - log_div "receivepack true" + log_div "receivepack true" && config http.receivepack true && GET info/refs?service=git-receive-pack "200 OK" && POST git-receive-pack 0000 "200 OK" ' test_expect_success 'http.receivepack false' ' - log_div "receivepack false" + log_div "receivepack false" && config http.receivepack false && GET info/refs?service=git-receive-pack "403 Forbidden" && POST git-receive-pack 0000 "403 Forbidden"
t/t6001-rev-list-graft.sh +4 -4
@@ -90,22 +90,22 @@ check () { for type in basic parents parents-raw do test_expect_success 'without grafts' " - rm -f .git/info/grafts + rm -f .git/info/grafts && check $type $B2 -- $B2 $B1 $B0 " test_expect_success 'with grafts' " - echo '$B0 $A2' >.git/info/grafts + echo '$B0 $A2' >.git/info/grafts && check $type $B2 -- $B2 $B1 $B0 $A2 $A1 $A0 " test_expect_success 'without grafts, with pathlimit' " - rm -f .git/info/grafts + rm -f .git/info/grafts && check $type $B2 subdir -- $B2 $B0 " test_expect_success 'with grafts, with pathlimit' " - echo '$B0 $A2' >.git/info/grafts + echo '$B0 $A2' >.git/info/grafts && check $type $B2 subdir -- $B2 $B0 $A2 $A0 "
t/t6009-rev-list-parent.sh +1 -1
@@ -18,7 +18,7 @@ test_expect_success setup ' commit one && - test_tick=$(($test_tick - 2400)) + test_tick=$(($test_tick - 2400)) && commit two && commit three &&
t/t6010-merge-base.sh +1 -1
@@ -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 &&
t/t6024-recursive-merge.sh +1 -1
@@ -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 &&
t/t6029-merge-subtree.sh +1 -1
@@ -6,7 +6,7 @@ test_description='subtree merge strategy' test_expect_success setup ' - s="1 2 3 4 5 6 7 8" + s="1 2 3 4 5 6 7 8" && for i in $s; do echo $i; done >hello && git add hello && git commit -m initial &&
t/t6030-bisect-porcelain.sh +4 -4
@@ -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) '
t/t6036-recursive-corner-cases.sh +1 -1
@@ -15,7 +15,7 @@ test_description='recursive merge corner cases' # test_expect_success setup ' - ten="0 1 2 3 4 5 6 7 8 9" + ten="0 1 2 3 4 5 6 7 8 9" && for i in $ten do echo line $i in a sample file
t/t6040-tracking-info.sh +1 -1
@@ -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 '
t/t6050-replace.sh +1 -1
@@ -53,7 +53,7 @@ test_expect_success 'set up buggy branch' ' echo "line 12" >> hello && echo "line 13" >> hello && add_and_commit_file hello "2 more lines" && - HASH6=$(git rev-parse --verify HEAD) + HASH6=$(git rev-parse --verify HEAD) && echo "line 14" >> hello && echo "line 15" >> hello && echo "line 16" >> hello &&
t/t7105-reset-patch.sh +3 -3
@@ -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
t/t7509-commit.sh +1 -1
@@ -40,7 +40,7 @@ test_expect_success '-C option copies only the message with --reset-author' ' test_tick && git commit -a -C Initial --reset-author && echo "author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> $GIT_AUTHOR_DATE" >expect && - author_header HEAD >actual + author_header HEAD >actual && test_cmp expect actual && message_body Initial >expect &&
t/t7602-merge-octopus-many.sh +1 -1
@@ -31,7 +31,7 @@ test_expect_success 'merge c1 with c2, c3, c4, ... c29' ' do refs="$refs c$i" i=`expr $i + 1` - done + done && git merge $refs && test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" && i=1 &&
t/t7610-mergetool.sh +1 -1
@@ -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 ) &&
t/t7810-grep.sh +2 -2
@@ -452,7 +452,7 @@ test_expect_success 'outside of git repository' ' echo file1:hello && echo sub/file2:world } >non/expect.full && - echo file2:world >non/expect.sub + echo file2:world >non/expect.sub && ( GIT_CEILING_DIRECTORIES="$(pwd)/non/git" && export GIT_CEILING_DIRECTORIES &&
@@ -478,7 +478,7 @@ test_expect_success 'inside git repository but with --no-index' ' echo sub/file2:world } >is/expect.full && : >is/expect.empty && - echo file2:world >is/expect.sub + echo file2:world >is/expect.sub && ( cd is/git && git init &&
t/t9104-git-svn-follow-parent.sh +1 -1
@@ -190,7 +190,7 @@ test_expect_success "follow-parent is atomic" ' git svn init --minimize-url -i stunk "$svnrepo"/stunk && git svn fetch -i stunk && git svn init --minimize-url -i flunked "$svnrepo"/flunked && - git svn fetch -i flunked + git svn fetch -i flunked && test "`git rev-parse --verify refs/remotes/flunk@18`" \ = "`git rev-parse --verify refs/remotes/stunk`" && test "`git rev-parse --verify refs/remotes/flunk~1`" \
t/t9123-git-svn-rebuild-with-rewriteroot.sh +1 -1
@@ -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} '
t/t9124-git-svn-dcommit-auto-props.sh +1 -1
@@ -24,7 +24,7 @@ test_expect_success 'initialize git svn' ' svn_cmd import -m "import for git svn" . "$svnrepo" ) && rm -rf import && - git svn init "$svnrepo" + git svn init "$svnrepo" && git svn fetch '
t/t9151-svn-mergeinfo.sh +11 -11
@@ -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" ] '
t/t9300-fast-import.sh +1 -1
@@ -321,7 +321,7 @@ test_expect_success \ 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' test_expect_success \ 'C: validate reuse existing blob' \ - 'test $newf = `git rev-parse --verify branch:file2/newf` + 'test $newf = `git rev-parse --verify branch:file2/newf` && test $oldf = `git rev-parse --verify branch:file2/oldf`' cat >expect <<EOF
t/t9350-fast-export.sh +1 -1
@@ -26,7 +26,7 @@ test_expect_success 'setup' ' test_tick && git tag rein && git checkout -b wer HEAD^ && - echo lange > file2 + echo lange > file2 && test_tick && git commit -m sitzt file2 && test_tick &&
t/t9400-git-cvsserver-server.sh +1 -1
@@ -57,7 +57,7 @@ test_expect_success 'setup' ' # as argument to co -d test_expect_success 'basic checkout' \ 'GIT_CONFIG="$git_config" cvs -Q co -d cvswork master && - test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | head -n 1))" = "empty/1.1/" + test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | head -n 1))" = "empty/1.1/" && test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5 | sed -ne \$p))" = "secondrootfile/1.1/"' #------------------------
t/t9401-git-cvsserver-crlf.sh +1 -1
@@ -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 &&
Signature · 1 line
1.7.2.3.557.gab647.dirty
Re: [PATCH en/cascade-tests] tests: add missing &&
t/t0050-filesystem.sh test_expect_success 'see what we expect' ' · line 33
Quoted 9 lines · Jonathan Nieder
t/t0050-filesystem.sh +1
-1@@ -27,7 +27,7 @@ test_expect_success 'see what we expect' ' >junk/"$auml" && case "$(cd junk && echo *)" in "$aumlcdiar") - test_unicode=test_expect_failure + test_unicode=test_expect_failure && unibad=t ;; *) ;;
This seems to prepare for a case where a simple variable assignment fails for whategver reason, which is not too bad, but ...
t/t0050-filesystem.sh test_expect_success 'see what we expect' ' · line 40
Quoted 7 lines
t/t0050-filesystem.sh +1
-1@@ -36,7 +36,7 @@ test_expect_success 'see what we expect' ' { ln -s x y 2> /dev/null && test -h y 2> /dev/null || - no_symlinks=1 + no_symlinks=1 && rm -f y
... if you allowed such a simple assignment failure, no_symlinks=1 may fail, and we end up not running "rm -f y" to clean up, which might be somewhat undesirable ;-)
Looked up to but not including t5302 and all looked Ok.
[PATCH/RFC 00/10] Re: [PATCH en/cascade-tests] tests: add missing &&
Quoted 13 lines · Junio C Hamano
t/t0050-filesystem.sh test_expect_success 'see what we expect' ' · line 40
Quoted 7 lines · Jonathan Nieder
t/t0050-filesystem.sh +1
-1@@ -36,7 +36,7 @@ test_expect_success 'see what we expect' ' { ln -s x y 2> /dev/null && test -h y 2> /dev/null || - no_symlinks=1 + no_symlinks=1 && rm -f y... if you allowed such a simple assignment failure, no_symlinks=1 may fail, and we end up not running "rm -f y" to clean up, which might be somewhat undesirable ;-)
Thanks. Will undo that bit in my local version.
Actually I don't see why the "rm -f y" is needed in the first place, but that is a question for another day.
Here's another batch of patches in the same &&-adding vein. I'm only sending 10 to the list for now; I can mete the rest out at whatever rate is useful to people.
Jonathan Nieder (27):
tests: more missing &&
test-lib: introduce test_line_count to measure files t6022 (renaming merge): chain test commands with && t1502 (rev-parse --parseopt): test exit code from "-h" t1400 (update-ref): use test_must_fail
t3301 (notes): use test_expect_code for clarity
t3404 (rebase -i): unroll test_commit loops
t3404 (rebase -i): move comment to description
t3404 (rebase -i): introduce helper to check position of HEAD t4124 (apply --whitespace): use test_might_fail
t5701 (clone -l): use test_must_fail
ttt03, t6032: use test_might_fail
t6032 (merge): give body of rename tests its own function t7001 (mv): introduce test_grep function and use it t7004 (tag): use test_must_fail
t9146 (git svn): check exit status from svn in loop t9146 (git svn): use test_path_is_dir/missing helpers t8007 (textconv): use test_must_fail
t7502 (commit): use test_must_fail
t0005 (signals): hide test-sigchain invocation from &&-chaining
checker
t0020 (convert): improve error checking in loops t0020 (convert): use diff-index --exit-code
t0020 (convert): remove "Huh?" noise
t0040 (parse-options): use test_expect_code
t7300 (clean): use test_cmp instead of test "$foo" = bar t1501 (rev-parse): use sane_unset
t4022 (diff -B): simplify using test_grep
t/README | 9 ++ t/t0005-signals.sh | 16 ++- t/t0020-crlf.sh | 247 +++++++++--------------------------- t/t0040-parse-options.sh | 12 +- t/t1400-update-ref.sh | 25 ++-- t/t1501-worktree.sh | 4 +- t/t1502-rev-parse-parseopt.sh | 2 +- t/t3301-notes.sh | 8 +- t/t3404-rebase-interactive.sh | 88 ++++++------- t/t4022-diff-rewrite.sh | 9 +- t/t4124-apply-ws-rule.sh | 11 +- t/t5503-tagfollow.sh | 10 +- t/t5701-clone-local.sh | 22 +--- t/t6022-merge-rename.sh | 282 +++++++++++++--------------------------- t/t6032-merge-large-rename.sh | 36 ++++-- t/t7001-mv.sh | 8 +- t/t7004-tag.sh | 36 +++--- t/t7300-clean.sh | 25 ++-- t/t7502-commit.sh | 4 +- t/t7700-repack.sh | 6 +- t/t8007-cat-file-textconv.sh | 2 +- t/t9146-git-svn-empty-dirs.sh | 64 ++++------ t/test-lib.sh | 57 ++++++++ 23 files changed, 395 insertions(+), 588 deletions(-)
Signature · 1 line
1.7.2.3.557.gab647.dirty
PATCH 1/10 tests: add missing &&, batch 2
Same rules as before: this patch only adds " &&" to the end of some lines in the test suite.
Intended to be applied on top of or squashed with the last batch if they look okay.
--- t/t0020-crlf.sh | 2 +- t/t1400-update-ref.sh | 20 ++++++++++---------- t/t3301-notes.sh | 6 +++--- t/t3404-rebase-interactive.sh | 6 +++--- t/t4124-apply-ws-rule.sh | 6 +++--- t/t5503-tagfollow.sh | 6 +++--- t/t5701-clone-local.sh | 6 +++--- t/t7001-mv.sh | 2 +- t/t7004-tag.sh | 30 +++++++++++++++--------------- t/t7300-clean.sh | 2 +- t/t7502-commit.sh | 2 +- t/t7700-repack.sh | 6 +++--- t/t9146-git-svn-empty-dirs.sh | 2 +- 13 files changed, 48 insertions(+), 48 deletions(-)
t/t0020-crlf.sh +1 -1
@@ -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 &&
t/t1400-update-ref.sh +10 -10
@@ -185,55 +185,55 @@ gd="Thu, 26 May 2005 18:33:00 -0500" ld="Thu, 26 May 2005 18:43:00 -0500" test_expect_success \ 'Query "master@{May 25 2005}" (before history)' \ - 'rm -f o e + 'rm -f o e && git rev-parse --verify "master@{May 25 2005}" >o 2>e && test '"$C"' = $(cat o) && test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"' test_expect_success \ "Query master@{2005-05-25} (before history)" \ - 'rm -f o e + 'rm -f o e && git rev-parse --verify master@{2005-05-25} >o 2>e && test '"$C"' = $(cat o) && echo test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"' test_expect_success \ 'Query "master@{May 26 2005 23:31:59}" (1 second before history)' \ - 'rm -f o e + 'rm -f o e && git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e && test '"$C"' = $(cat o) && test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"' test_expect_success \ 'Query "master@{May 26 2005 23:32:00}" (exactly history start)' \ - 'rm -f o e + 'rm -f o e && git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e && test '"$C"' = $(cat o) && test "" = "$(cat e)"' test_expect_success \ 'Query "master@{May 26 2005 23:32:30}" (first non-creation change)' \ - 'rm -f o e + 'rm -f o e && git rev-parse --verify "master@{May 26 2005 23:32:30}" >o 2>e && test '"$A"' = $(cat o) && test "" = "$(cat e)"' test_expect_success \ 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' \ - 'rm -f o e + 'rm -f o e && git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e && test '"$B"' = $(cat o) && test "warning: Log .git/logs/'"$m has gap after $gd"'." = "$(cat e)"' test_expect_success \ 'Query "master@{2005-05-26 23:38:00}" (middle of history)' \ - 'rm -f o e + 'rm -f o e && git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e && test '"$Z"' = $(cat o) && test "" = "$(cat e)"' test_expect_success \ 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' \ - 'rm -f o e + 'rm -f o e && git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e && test '"$E"' = $(cat o) && test "" = "$(cat e)"' test_expect_success \ 'Query "master@{2005-05-28}" (past end of history)' \ - 'rm -f o e + 'rm -f o e && git rev-parse --verify "master@{2005-05-28}" >o 2>e && test '"$D"' = $(cat o) && test "warning: Log .git/logs/'"$m unexpectedly ended on $ld"'." = "$(cat e)"'
@@ -247,7 +247,7 @@ test_expect_success \ git add F && GIT_AUTHOR_DATE="2005-05-26 23:30" \ GIT_COMMITTER_DATE="2005-05-26 23:30" git commit -m add -a && - h_TEST=$(git rev-parse --verify HEAD) + h_TEST=$(git rev-parse --verify HEAD) && echo The other day this did not work. >M && echo And then Bob told me how to fix it. >>M && echo OTHER >F &&
t/t3301-notes.sh +3 -3
@@ -627,16 +627,16 @@ test_expect_success '--show-notes=ref accumulates' ' test_expect_success 'Allow notes on non-commits (trees, blobs, tags)' ' git config core.notesRef refs/notes/other && - echo "Note on a tree" > expect + echo "Note on a tree" > expect && git notes add -m "Note on a tree" HEAD: && git notes show HEAD: > actual && test_cmp expect actual && - echo "Note on a blob" > expect + echo "Note on a blob" > expect && filename=$(git ls-tree --name-only HEAD | head -n1) && git notes add -m "Note on a blob" HEAD:$filename && git notes show HEAD:$filename > actual && test_cmp expect actual && - echo "Note on a tag" > expect + echo "Note on a tag" > expect && git tag -a -m "This is an annotated tag" foobar HEAD^ && git notes add -m "Note on a tag" foobar && git notes show foobar > actual &&
t/t3404-rebase-interactive.sh +3 -3
@@ -46,7 +46,7 @@ test_expect_success 'setup' ' test_commit G file1 && test_commit H file5 && git checkout -b branch2 F && - test_commit I file6 + test_commit I file6 && git checkout -b conflict-branch A && for n in one two three four do
@@ -584,7 +584,7 @@ test_expect_success 'do "noop" when there is nothing to cherry-pick' ' git checkout -b branch4 HEAD && GIT_EDITOR=: git commit --amend \ - --author="Somebody else <[email protected]>" + --author="Somebody else <[email protected]>" && test $(git rev-parse branch3) != $(git rev-parse branch4) && git rebase -i branch3 && test $(git rev-parse branch3) = $(git rev-parse branch4)
@@ -599,7 +599,7 @@ test_expect_success 'submodule rebase setup' ' git add elif && git commit -m "submodule initial" ) && echo 1 >file1 && - git add file1 sub + git add file1 sub && test_tick && git commit -m "One" && echo 2 >file1 &&
t/t4124-apply-ws-rule.sh +3 -3
@@ -368,7 +368,7 @@ test_expect_success 'missing blanks at EOF must only match blank lines' ' git diff -- one >patch && echo a >one && - test_must_fail git apply patch + test_must_fail git apply patch && test_must_fail git apply --whitespace=fix patch && test_must_fail git apply --ignore-space-change --whitespace=fix patch '
@@ -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 &&
t/t5503-tagfollow.sh +3 -3
@@ -54,7 +54,7 @@ EOF ' test_expect_success NOT_MINGW 'fetch A (new commit : 1 connection)' ' - rm -f $U + rm -f $U && ( cd cloned && GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
@@ -87,7 +87,7 @@ EOF ' test_expect_success NOT_MINGW 'fetch C, T (new branch, tag : 1 connection)' ' - rm -f $U + rm -f $U && ( cd cloned && GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
@@ -126,7 +126,7 @@ EOF ' test_expect_success NOT_MINGW 'fetch B, S (commit and tag : 1 connection)' ' - rm -f $U + rm -f $U && ( cd cloned && GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
t/t5701-clone-local.sh +3 -3
@@ -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 '
t/t7001-mv.sh +1 -1
@@ -207,7 +207,7 @@ test_expect_success 'git mv should not change sha1 of moved cache entry' ' git init && echo 1 >dirty && git add dirty && - entry="$(git ls-files --stage dirty | cut -f 1)" + entry="$(git ls-files --stage dirty | cut -f 1)" && git mv dirty dirty2 && [ "$entry" = "$(git ls-files --stage dirty2 | cut -f 1)" ] && echo 2 >dirty2 &&
t/t7004-tag.sh +15 -15
@@ -1097,7 +1097,7 @@ hash1=$(git rev-parse HEAD) test_expect_success 'creating second commit and tag' ' echo foo-2.0 >foo && git add foo && - git commit -m second + git commit -m second && git tag v2.0 '
@@ -1122,18 +1122,18 @@ 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 " # other ways of specifying the commit test_expect_success 'checking that first commit is in all tags (tag)' " - git tag -l --contains v1.0 v* >actual + git tag -l --contains v1.0 v* >actual && test_cmp expected actual " test_expect_success 'checking that first commit is in all tags (relative)' " - git tag -l --contains HEAD~2 v* >actual + git tag -l --contains HEAD~2 v* >actual && test_cmp expected actual "
@@ -1142,7 +1142,7 @@ v2.0 EOF test_expect_success 'checking that second commit only has one tag' " - git tag -l --contains $hash2 v* >actual + git tag -l --contains $hash2 v* >actual && test_cmp expected actual "
@@ -1151,7 +1151,7 @@ cat > expected <<EOF EOF test_expect_success 'checking that third commit has no tags' " - git tag -l --contains $hash3 v* >actual + git tag -l --contains $hash3 v* >actual && test_cmp expected actual "
@@ -1161,7 +1161,7 @@ test_expect_success 'creating simple branch' ' git branch stable v2.0 && git checkout stable && echo foo-3.0 > foo && - git commit foo -m fourth + git commit foo -m fourth && git tag v3.0 '
@@ -1172,7 +1172,7 @@ v3.0 EOF test_expect_success 'checking that branch head only has one tag' " - git tag -l --contains $hash4 v* >actual + git tag -l --contains $hash4 v* >actual && test_cmp expected actual "
@@ -1186,7 +1186,7 @@ v4.0 EOF test_expect_success 'checking that original branch head has one tag now' " - git tag -l --contains $hash3 v* >actual + git tag -l --contains $hash3 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 '
t/t7300-clean.sh +1 -1
@@ -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 &&
t/t7502-commit.sh +1 -1
@@ -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 '
t/t7700-repack.sh +3 -3
@@ -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) &&
@@ -95,14 +95,14 @@ test_expect_success 'packed obs in alternate ODB kept pack are repacked' ' # swap the .keep so the commit object is in the pack with .keep for p in alt_objects/pack/*.pack do - base_name=$(basename $p .pack) + base_name=$(basename $p .pack) && if test -f alt_objects/pack/$base_name.keep then rm alt_objects/pack/$base_name.keep else touch alt_objects/pack/$base_name.keep fi - done + done && git repack -a -d && myidx=$(ls -1 .git/objects/pack/*.idx) && test -f "$myidx" &&
t/t9146-git-svn-empty-dirs.sh +1 -1
@@ -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/"! !" '
Signature · 1 line
1.7.2.3.557.gab647.dirty
PATCH 2/10 test-lib: introduce test_line_count to measure files
In reply to Jonathan NiederSome tests check their output with code like the following:
test "$(git ls-files -u B | wc -l)" -eq 3 || {
echo "BAD: should have left stages for B"
return 1
}The verbose failure condition is used because test, unlike diff, does not print any useful information about the nature of the failure when it fails.
Introduce a test_line_count function to help. If used like
git ls-files -u B >output && test_line_count -eq 3 output
it will produce output like
test_line_count: line count for output !-eq 3 100644 b023018cabc396e7692c70bbf5784a93d3f738ab 2 hi.c 100644 45b983be36b73c0788dc9cbcb76cbb80fc7bb057 3 hi.c
on failure.
---
I don't imagine this would be too helpful for new tests, but the idiom is common enough in old tests that maybe I'm wrong about that.
t/README | 4 ++++ t/test-lib.sh | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 0 deletions(-)
t/README +4 -0
@@ -500,6 +500,10 @@ library for your script to use. <expected> file. This behaves like "cmp" but produces more helpful output when the test is run with "-v" option. + - test_line_count (= | -lt | -ge | ...) <length> <file> + + Check whether a file has the length it is expected to. + - test_path_is_file <file> [<diagnosis>] test_path_is_dir <dir> [<diagnosis>] test_path_is_missing <path> [<diagnosis>]
t/test-lib.sh +22 -0
@@ -598,6 +598,28 @@ test_path_is_missing () { fi } +# test_line_count checks that a file has the number of lines it +# ought to. For example: +# +# test_expect_success 'produce exactly one line of output' ' +# do something >output && +# test_line_count = 1 output +# ' +# +# is like "test $(wc -l <output) = 1" except that it passes the +# output through when the number of lines is wrong. + +test_line_count () { + if test $# != 3 + then + error "bug in the test script: not 3 parameters to test_line_count" + elif ! test $(wc -l <"$3") "$1" "$2" + then + echo "test_line_count: line count for $3 !$1 $2" + cat "$3" + return 1 + fi +} # This is not among top-level (test_expect_success | test_expect_failure) # but is a prefix that can be used in the test script, like:
Signature · 1 line
1.7.2.3.557.gab647.dirty
PATCH 3/10 t6022 (renaming merge): chain test commands with &&
In reply to Jonathan NiederUsing 'return' in an attempt to end a test assertion can have unpredictable results (probably escaping from test_run_ and breaking its bookkeeping). Redo the control flow using helpers like test_expect_code and git diff --exit-code, so each test assertion can follow the usual form
command that should succeed && command that should succeed && command that should succeed && ...
--- t/t6022-merge-rename.sh | 282 +++++++++++++++------------------------------- 1 files changed, 92 insertions(+), 190 deletions(-)
t/t6022-merge-rename.sh +92 -190
@@ -94,245 +94,147 @@ git checkout master' test_expect_success 'pull renaming branch into unrenaming one' \ ' - git show-branch - git pull . white && { - echo "BAD: should have conflicted" - return 1 - } - git ls-files -s - test "$(git ls-files -u B | wc -l)" -eq 3 || { - echo "BAD: should have left stages for B" - return 1 - } - test "$(git ls-files -s N | wc -l)" -eq 1 || { - echo "BAD: should have merged N" - return 1 - } + git show-branch && + test_expect_code 1 git pull . white && + git ls-files -s && + git ls-files -u B >b.stages && + test_line_count = 3 b.stages && + git ls-files -s N >n.stages && + test_line_count = 1 n.stages && sed -ne "/^g/{ p q - }" B | grep master || { - echo "BAD: should have listed our change first" - return 1 - } - test "$(git diff white N | wc -l)" -eq 0 || { - echo "BAD: should have taken colored branch" - return 1 - } + }" B | grep master && + git diff --exit-code white N ' test_expect_success 'pull renaming branch into another renaming one' \ ' - rm -f B - git reset --hard - git checkout red - git pull . white && { - echo "BAD: should have conflicted" - return 1 - } - test "$(git ls-files -u B | wc -l)" -eq 3 || { - echo "BAD: should have left stages" - return 1 - } - test "$(git ls-files -s N | wc -l)" -eq 1 || { - echo "BAD: should have merged N" - return 1 - } + rm -f B && + git reset --hard && + git checkout red && + test_expect_code 1 git pull . white && + git ls-files -u B >b.stages && + test_line_count = 3 b.stages && + git ls-files -s N >n.stages && + test_line_count = 1 n.stages && sed -ne "/^g/{ p q - }" B | grep red || { - echo "BAD: should have listed our change first" - return 1 - } - test "$(git diff white N | wc -l)" -eq 0 || { - echo "BAD: should have taken colored branch" - return 1 - } + }" B | grep red && + git diff --exit-code white N ' test_expect_success 'pull unrenaming branch into renaming one' \ ' - git reset --hard - git show-branch - git pull . master && { - echo "BAD: should have conflicted" - return 1 - } - test "$(git ls-files -u B | wc -l)" -eq 3 || { - echo "BAD: should have left stages" - return 1 - } - test "$(git ls-files -s N | wc -l)" -eq 1 || { - echo "BAD: should have merged N" - return 1 - } + git reset --hard && + git show-branch && + test_expect_code 1 git pull . master && + git ls-files -u B >b.stages && + test_line_count = 3 b.stages && + git ls-files -s N >n.stages && + test_line_count = 1 n.stages && sed -ne "/^g/{ p q - }" B | grep red || { - echo "BAD: should have listed our change first" - return 1 - } - test "$(git diff white N | wc -l)" -eq 0 || { - echo "BAD: should have taken colored branch" - return 1 - } + }" B | grep red && + git diff --exit-code white N ' test_expect_success 'pull conflicting renames' \ ' - git reset --hard - git show-branch - git pull . blue && { - echo "BAD: should have conflicted" - return 1 - } - test "$(git ls-files -u A | wc -l)" -eq 1 || { - echo "BAD: should have left a stage" - return 1 - } - test "$(git ls-files -u B | wc -l)" -eq 1 || { - echo "BAD: should have left a stage" - return 1 - } - test "$(git ls-files -u C | wc -l)" -eq 1 || { - echo "BAD: should have left a stage" - return 1 - } - test "$(git ls-files -s N | wc -l)" -eq 1 || { - echo "BAD: should have merged N" - return 1 - } + git reset --hard && + git show-branch && + test_expect_code 1 git pull . blue && + git ls-files -u A >a.stages && + test_line_count = 1 a.stages && + git ls-files -u B >b.stages && + test_line_count = 1 b.stages && + git ls-files -u C >c.stages && + test_line_count = 1 c.stages && + git ls-files -s N >n.stages && + test_line_count = 1 n.stages && sed -ne "/^g/{ p q - }" B | grep red || { - echo "BAD: should have listed our change first" - return 1 - } - test "$(git diff white N | wc -l)" -eq 0 || { - echo "BAD: should have taken colored branch" - return 1 - } + }" B | grep red && + git diff --exit-code white N ' test_expect_success 'interference with untracked working tree file' ' - - git reset --hard - git show-branch - echo >A this file should not matter - git pull . white && { - echo "BAD: should have conflicted" - return 1 - } - test -f A || { - echo "BAD: should have left A intact" - return 1 - } + git reset --hard && + git show-branch && + echo >A this file should not matter && + test_expect_code 1 git pull . white && + test_path_is_file A ' test_expect_success 'interference with untracked working tree file' ' - - git reset --hard - git checkout white - git show-branch - rm -f A - echo >A this file should not matter - git pull . red && { - echo "BAD: should have conflicted" - return 1 - } - test -f A || { - echo "BAD: should have left A intact" - return 1 - } + git reset --hard && + git checkout white && + git show-branch && + rm -f A && + echo >A this file should not matter && + test_expect_code 1 git pull . red && + test_path_is_file A ' test_expect_success 'interference with untracked working tree file' ' - - git reset --hard - rm -f A M - git checkout -f master - git tag -f anchor - git show-branch - git pull . yellow || { - echo "BAD: should have cleanly merged" - return 1 - } - test -f M && { - echo "BAD: should have removed M" - return 1 - } + git reset --hard && + rm -f A M && + git checkout -f master && + git tag -f anchor && + git show-branch && + git pull . yellow && + test_path_is_missing M && git reset --hard anchor ' test_expect_success 'updated working tree file should prevent the merge' ' - - git reset --hard - rm -f A M - git checkout -f master - git tag -f anchor - git show-branch - echo >>M one line addition - cat M >M.saved - git pull . yellow && { - echo "BAD: should have complained" - return 1 - } - test_cmp M M.saved || { - echo "BAD: should have left M intact" - return 1 - } + git reset --hard && + rm -f A M && + git checkout -f master && + git tag -f anchor && + git show-branch && + echo >>M one line addition && + cat M >M.saved && + test_expect_code 128 git pull . yellow && + test_cmp M M.saved && rm -f M.saved ' test_expect_success 'updated working tree file should prevent the merge' ' - - git reset --hard - rm -f A M - git checkout -f master - git tag -f anchor - git show-branch - echo >>M one line addition - cat M >M.saved - git update-index M - git pull . yellow && { - echo "BAD: should have complained" - return 1 - } - test_cmp M M.saved || { - echo "BAD: should have left M intact" - return 1 - } + git reset --hard && + rm -f A M && + git checkout -f master && + git tag -f anchor && + git show-branch && + echo >>M one line addition && + cat M >M.saved && + git update-index M && + test_expect_code 128 git pull . yellow && + test_cmp M M.saved && rm -f M.saved ' test_expect_success 'interference with untracked working tree file' ' - - git reset --hard - rm -f A M - git checkout -f yellow - git tag -f anchor - git show-branch - echo >M this file should not matter - git pull . master || { - echo "BAD: should have cleanly merged" - return 1 - } - test -f M || { - echo "BAD: should have left M intact" - return 1 - } - git ls-files -s | grep M && { - echo "BAD: M must be untracked in the result" - return 1 - } + git reset --hard && + rm -f A M && + git checkout -f yellow && + git tag -f anchor && + git show-branch && + echo >M this file should not matter && + git pull . master && + test_path_is_file M && + ! { + git ls-files -s | + grep M + } && git reset --hard anchor ' 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" &&
Signature · 1 line
1.7.2.3.557.gab647.dirty
PATCH 4/10 t1502 (rev-parse --parseopt): test exit code from "-h"
In reply to Jonathan Niederrev-parse --parseopt exits with code 129 (usage error) when asked to dump usage with -h on behalf of another command. Scripts can take advantage of this to avoid trying to parse usage information as though it were the regular output from some git command.
Noticed with an &&-chaining tester.
--- t/t1502-rev-parse-parseopt.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
t/t1502-rev-parse-parseopt.sh +1 -1
@@ -40,7 +40,7 @@ extra1 line above used to cause a segfault but no longer does EOF test_expect_success 'test --parseopt help output' ' - git rev-parse --parseopt -- -h > output < optionspec + test_expect_code 129 git rev-parse --parseopt -- -h > output < optionspec && test_cmp expect output '
Signature · 1 line
1.7.2.3.557.gab647.dirty
PATCH 5/10 t1400 (update-ref): use test_must_fail
In reply to Jonathan NiederAs t/README explains:
When a gitcommand dies due to a segfault, test_must_fail diagnoses it as an error; "! git <command>" treats it as just another expected failure, which would let such a bug go unnoticed.
--- t/t1400-update-ref.sh | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
t/t1400-update-ref.sh +2 -3
@@ -52,9 +52,8 @@ rm -f .git/$m test_expect_success \ "fail to create $n" \ - "touch .git/$n_dir - git update-ref $n $A >out 2>err"' - test $? != 0' + "touch .git/$n_dir && + test_must_fail git update-ref $n $A >out 2>err" rm -f .git/$n_dir out err test_expect_success \
Signature · 1 line
1.7.2.3.557.gab647.dirty
PATCH 6/10 t3301 (notes): use test_expect_code for clarity
In reply to Jonathan NiederUse the test_expect_code helper instead of open-coding it.
The main behavior change is to print the command and actual exit status when the test fails. More importantly, this would make it easier to add commands before "git notes show" as part of the same test assertion if needed.
--- t/t3301-notes.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
t/t3301-notes.sh +1 -1
@@ -52,7 +52,7 @@ test_expect_success 'refusing to edit notes in refs/remotes/' ' # 1 indicates caught gracefully by die, 128 means git-show barked test_expect_success 'handle empty notes gracefully' ' - git notes show ; test 1 = $? + test_expect_code 1 git notes show ' test_expect_success 'show non-existent notes entry with %N' '
Signature · 1 line
1.7.2.3.557.gab647.dirty
PATCH 7/10 t3404 (rebase -i): unroll test_commit loops
In reply to Jonathan NiederAllow test_commit failures in loop iterations before the last one to cause the test assertion to fail.
More importantly, avoiding these loops makes the test a little simpler to read and decreases the vertical screen footprint of the setup test assertion by one line.
--- t/t3404-rebase-interactive.sh | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-)
t/t3404-rebase-interactive.sh +11 -12
@@ -48,20 +48,19 @@ test_expect_success 'setup' ' git checkout -b branch2 F && test_commit I file6 && git checkout -b conflict-branch A && - for n in one two three four - do - test_commit $n conflict - done && + test_commit one conflict && + test_commit two conflict && + test_commit three conflict && + test_commit four conflict && git checkout -b no-conflict-branch A && - for n in J K L M - do - test_commit $n file$n - done && + test_commit J fileJ && + test_commit K fileK && + test_commit L fileL && + test_commit M fileM && git checkout -b no-ff-branch A && - for n in N O P - do - test_commit $n file$n - done + test_commit N fileN && + test_commit O fileO && + test_commit P fileP ' # "exec" commands are ran with the user shell by default, but this may
Signature · 1 line
1.7.2.3.557.gab647.dirty
PATCH 8/10 t3404 (rebase -i): move comment to description
In reply to Jonathan NiederAdd a comment describing the setup in t3404 to its --help output.
This should make it easier to decide where to put new functions without disrupting the flow of the file or obstructing the description of the test setup.
--- t/t3404-rebase-interactive.sh | 35 +++++++++++++++++------------------ 1 files changed, 17 insertions(+), 18 deletions(-)
t/t3404-rebase-interactive.sh +17 -18
@@ -7,6 +7,23 @@ test_description='git rebase interactive This test runs git rebase "interactively", by faking an edit, and verifies that the result still makes sense. + +Initial setup: + + one - two - three - four (conflict-branch) + / + A - B - C - D - E (master) + | \ + | F - G - H (branch1) + | \ + |\ I (branch2) + | \ + | J - K - L - M (no-conflict-branch) + \ + N - O - P (no-ff-branch) + + where A, B, D and G all touch file1, and one, two, three, four all + touch file "conflict". ' . ./test-lib.sh
@@ -14,27 +31,9 @@ that the result still makes sense. set_fake_editor -# Set up the repository like this: -# -# one - two - three - four (conflict-branch) -# / -# A - B - C - D - E (master) -# | \ -# | F - G - H (branch1) -# | \ -# |\ I (branch2) -# | \ -# | J - K - L - M (no-conflict-branch) -# \ -# N - O - P (no-ff-branch) -# -# where A, B, D and G all touch file1, and one, two, three, four all -# touch file "conflict". -# # WARNING: Modifications to the initial repository can change the SHA ID used # in the expect2 file for the 'stop on conflicting pick' test. - test_expect_success 'setup' ' test_commit A file1 && test_commit B file1 &&
Signature · 1 line
1.7.2.3.557.gab647.dirty
PATCH 9/10 t3404 (rebase -i): introduce helper to check position of HEAD
In reply to Jonathan NiederThe same code to check the position of HEAD is used by several tests in this script. Factor it out as a function and simplify it.
Noticed using an &&-chaining tester, because the current code does not propagate the precise exit status from errors.
--- t/t3404-rebase-interactive.sh | 24 +++++++++--------------- 1 files changed, 9 insertions(+), 15 deletions(-)
t/t3404-rebase-interactive.sh +9 -15
@@ -29,6 +29,12 @@ Initial setup: . "$TEST_DIRECTORY"/lib-rebase.sh +test_cmp_rev () { + git describe --always --tags "$1" >expect.rev && + git describe --always --tags "$2" >actual.rev && + test_cmp expect.rev actual.rev +} + set_fake_editor # WARNING: Modifications to the initial repository can change the SHA ID used
@@ -80,20 +86,12 @@ test_expect_success 'rebase -i with the exec command' ' test_path_is_file touch-one && test_path_is_file touch-two && test_path_is_missing touch-three " (should have stopped before)" && - test $(git rev-parse C) = $(git rev-parse HEAD) || { - echo "Stopped at wrong revision:" - echo "($(git describe --tags HEAD) instead of C)" - false - } && + test_cmp_rev C HEAD && git rebase --continue && test_path_is_file touch-three && test_path_is_file "touch-file name with spaces" && test_path_is_file touch-after-semicolon && - test $(git rev-parse master) = $(git rev-parse HEAD) || { - echo "Stopped at wrong revision:" - echo "($(git describe --tags HEAD) instead of master)" - false - } && + test_cmp_rev master HEAD && rm -f touch-* '
@@ -114,11 +112,7 @@ test_expect_success 'rebase -i with the exec command checks tree cleanness' ' export FAKE_LINES && test_must_fail git rebase -i HEAD^ ) && - test $(git rev-parse master^) = $(git rev-parse HEAD) || { - echo "Stopped at wrong revision:" - echo "($(git describe --tags HEAD) instead of master^)" - false - } && + test_cmp_rev master^ HEAD && git reset --hard && git rebase --continue '
Signature · 1 line
1.7.2.3.557.gab647.dirty
PATCH 10/10 t4124 (apply --whitespace): use test_might_fail
In reply to Jonathan NiederUse test_might_fail instead of ignoring the exit status from git config --unset, and let the exit status propagate past rm -f (which does not fail on ENOENT). Otherwise bugs that lead git config to crash would not be detected when this test runs.
--- t/t4124-apply-ws-rule.sh | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
t/t4124-apply-ws-rule.sh +2 -3
@@ -176,9 +176,8 @@ test_expect_success 'trailing whitespace & no newline at the end of file' ' ' test_expect_success 'blank at EOF with --whitespace=fix (1)' ' - : these can fail depending on what we did before - git config --unset core.whitespace - rm -f .gitattributes + test_might_fail git config --unset core.whitespace && + rm -f .gitattributes && { echo a; echo b; echo c; } >one && git add one &&
Signature · 1 line
1.7.2.3.557.gab647.dirty
Re: [PATCH en/cascade-tests] tests: add missing &&
In reply to Jonathan NiederHi,
Quoted 7 lines · Jonathan Nieder
Breaks in a test assertion's && chain can potentially hide failures from earlier commands in the chain.
Commands intended to fail should be marked with !,
test_must_fail, ortest_might_fail. The examples in this patch do not require that.Signed-off-by Jonathan Nieder <[email protected]>
Quoted 8 lines
---
Hi,Just found some time to work through reports from the && checker. The examples below only add && to the end of lines in various tests. Passes all tests there (though of course that does not mean much).
Thoughts?
I haven't had a chance to look at this in detail, but this is really cool. Thanks for working on it. (And sorry for disappearing for over a month with some unfinished series; I'll try to update them this weekend.)
Elijah
Re: [RFC/PATCH 02/10] test-lib: introduce test_line_count to measure files
In reply to Jonathan NiederQuoted 5 lines · Jonathan Nieder
Introduce a
test_line_countfunction to help. If used likegit ls-files -u B >output && test_line_count -eq 3 output
Quoted 7 lines
it will produce output like
test_line_count: line count for output !-eq 3 100644 b023018cabc396e7692c70bbf5784a93d3f738ab 2 hi.c 100644 45b983be36b73c0788dc9cbcb76cbb80fc7bb057 3 hi.con failure.
Sounds like a sane thing to do.
Especially because you wrote the implementation without surrounding dq pair, the callers can say "test_line_count = $N $file" instead of -eq and things will not break. Nice.
Re: [RFC/PATCH 02/10] test-lib: introduce test_line_count to measure files
In reply to Jonathan NiederQuoted 7 lines · Jonathan Nieder
Some tests check their output with code like the following:
test "$(git ls-files -u B | wc -l)" -eq 3 || { echo "BAD: should have left stages for B" return 1
}
Quoted 8 lines
The verbose failure condition is used because test, unlike diff, does not print any useful information about the nature of the failure when it fails.
Introduce a
test_line_countfunction to help. If used likegit ls-files -u B >output &&
test_line_count -eq 3 output
In an earlier thread I suggested an interface like:
test_line_count 3 "git ls-files -u B"
But I like yours much better. Ack.
Re: [PATCH en/cascade-tests] tests: add missing &&
In reply to Junio C HamanoQuoted 1 line · Junio C Hamano
Looked up to but not including t5302 and all looked Ok.
I looked at the rest and it looked fine. Queued on top of en/and-cascade-tests and seems to merge to 'pu' without much conflicts.
Thanks.
Re: [PATCH 08/10] t3404 (rebase -i): move comment to description
In reply to Jonathan NiederQuoted 1 line · Jonathan Nieder
Add a comment describing the setup in t3404 to its --help output.
You learn new things every day---I didn't know our tests supported the -h option ;-)
Yeah, yeah, e1970ce ([PATCH 1/2] Test framework take two., 2005-05-13) was mine, but I forgot all about it.
Re: [PATCH 09/10] t3404 (rebase -i): introduce helper to check position of HEAD
In reply to Jonathan NiederQuoted 2 lines · Jonathan Nieder
The same code to check the position of HEAD is used by several tests in this script. Factor it out as a function and simplify it.
That rationale makes sense, but why use describe for it, especially if the helper is called "cmp-rev"? The tests here are not about catching breakages in describe.
When we later want to move this helper to test-lib.sh, some potential callers may find it inconvenient that use of describe robs the ability to tell annotated tags from bare commits.
Quoted 5 lines
t/t3404-rebase-interactive.sh +5
-0+test_cmp_rev () { + git describe --always --tags "$1" >expect.rev && + git describe --always --tags "$2" >actual.rev && + test_cmp expect.rev actual.rev +}
Write good cheer, host.
--------------------------------------------------------
This
http://www.tomtop.com/black-remote-controller-charger2x-2800mah-battery-packs-for-wii_p11124.html?aid=z
Wii Charger looks good n stylish. It lights up all blue which made me think this is good. Get a
http://www.tomtop.com/mini-bluetooth-keyboard-for-ps3-mac-os-android-pc-pda.html?aid=z
Wireless Keyboard and mouse combo for your computer workstation and reduce desktop clutter.
-----
The voice input and output is very good in this
http://www.tomtop.com/black-ps3-wireless-bluetooth-headset-for-playstation-3.html?aid=z
Wireless PS3 Headset . It is compatible with all PS3 games.Buy from Reliable
http://www.tomtop.com/google-android-7-notebook-3g-tablet-pc-umpc-wifi-mid-pda.html?aid=z
Google Android PC apad Wholesalers.
Signature · 2 lines
View this message in context: http://git.661346.n2.nabble.com/PATCHv6-00-16-Add-missing-s-in-the-testsuite-tp5596961p5598912.html Sent from the git mailing list archive at Nabble.com.