{"thread":{"id":"34758","subject":"[PATCH 3/3] t/t7106-reset-unborn-branch.sh: Add PERL prerequisite","startedAt":"2013-08-24T04:01:43Z","lastAt":"2013-08-25T07:09:11Z","messageCount":12,"participants":["Kacper Kornet","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"225772","messageId":"1377316906-70338-1-git-send-email-draenog@pld-linux.org","threadId":"34758","inReplyTo":null,"subject":"[PATCH 0/3] Fixes for tests run without perl","fromName":"Kacper Kornet","fromEmail":"draenog@pld-linux.org","sentAt":"2013-08-24T04:01:43Z","receivedAt":"2013-08-24T04:01:43Z","isPatch":true,"sender":{"key":"draenog@pld-linux.org","avatar":"https://avatars.githubusercontent.com/u/608762?v=4"},"body":"This is a set of fixes for problems found while running\ntest suite without perl installed.\n\nKacper\n"},{"id":"225771","messageId":"1377316906-70338-2-git-send-email-draenog@pld-linux.org","threadId":"34758","inReplyTo":"1377316906-70338-1-git-send-email-draenog@pld-linux.org","subject":"[PATCH 1/3] Make test \"using invalid commit with -C\" more strict","fromName":"Kacper Kornet","fromEmail":"draenog@pld-linux.org","sentAt":"2013-08-24T04:01:44Z","receivedAt":"2013-08-24T04:01:44Z","isPatch":true,"sender":{"key":"draenog@pld-linux.org","avatar":"https://avatars.githubusercontent.com/u/608762?v=4"},"body":"In the test 'using invalid commit with -C' git-commit would have failed\neven if the -C option  had been given the correct commit, as there was\nnothing to commit. Fix it by making sure there is always something to\ncommit and git-commit fails because of the invalid commit provided to\nit.\n\nSigned-off-by: Kacper Kornet <draenog@pld-linux.org>\n---\n t/t7501-commit.sh | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t7501-commit.sh b/t/t7501-commit.sh\nindex 99ce36f..699a603 100755\n--- a/t/t7501-commit.sh\n+++ b/t/t7501-commit.sh\n@@ -53,7 +53,10 @@ test_expect_success PERL 'can use paths with --interactive' '\n '\n \n test_expect_success 'using invalid commit with -C' '\n-\ttest_must_fail git commit -C bogus\n+\techo bong >file &&\n+\tgit add file &&\n+\ttest_must_fail git commit -C bogus &&\n+\tgit reset\n '\n \n test_expect_success 'nothing to commit' '\n-- \n1.8.3.4\n"},{"id":"225770","messageId":"1377316906-70338-3-git-send-email-draenog@pld-linux.org","threadId":"34758","inReplyTo":"1377316906-70338-1-git-send-email-draenog@pld-linux.org","subject":"[PATCH 2/3] t/t3701-add-interactive.sh: Add PERL prerequisite","fromName":"Kacper Kornet","fromEmail":"draenog@pld-linux.org","sentAt":"2013-08-24T04:01:45Z","receivedAt":"2013-08-24T04:01:45Z","isPatch":true,"sender":{"key":"draenog@pld-linux.org","avatar":"https://avatars.githubusercontent.com/u/608762?v=4"},"body":"The test 'patch mode ignores unmerged entries' uses git-add -p, so it\ndepends on the perl code.\n\nSigned-off-by: Kacper Kornet <draenog@pld-linux.org>\n---\n t/t3701-add-interactive.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh\nindex 9fab25c..8514220 100755\n--- a/t/t3701-add-interactive.sh\n+++ b/t/t3701-add-interactive.sh\n@@ -330,7 +330,7 @@ test_expect_success PERL 'split hunk \"add -p (edit)\"' '\n \t! grep \"^+15\" actual\n '\n \n-test_expect_success 'patch mode ignores unmerged entries' '\n+test_expect_success PERL 'patch mode ignores unmerged entries' '\n \tgit reset --hard &&\n \ttest_commit conflict &&\n \ttest_commit non-conflict &&\n-- \n1.8.3.4\n"},{"id":"225769","messageId":"1377316906-70338-4-git-send-email-draenog@pld-linux.org","threadId":"34758","inReplyTo":"1377316906-70338-1-git-send-email-draenog@pld-linux.org","subject":"[PATCH 3/3] t/t7106-reset-unborn-branch.sh: Add PERL prerequisite","fromName":"Kacper Kornet","fromEmail":"draenog@pld-linux.org","sentAt":"2013-08-24T04:01:46Z","receivedAt":"2013-08-24T04:01:46Z","isPatch":true,"sender":{"key":"draenog@pld-linux.org","avatar":"https://avatars.githubusercontent.com/u/608762?v=4"},"body":"The test 'reset -p' uses git-reset -p, so it depends on the perl code.\n\nSigned-off-by: Kacper Kornet <draenog@pld-linux.org>\n---\n t/t7106-reset-unborn-branch.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t7106-reset-unborn-branch.sh b/t/t7106-reset-unborn-branch.sh\nindex 8062cf5..499cd88 100755\n--- a/t/t7106-reset-unborn-branch.sh\n+++ b/t/t7106-reset-unborn-branch.sh\n@@ -27,7 +27,7 @@ test_expect_success 'reset $file' '\n \ttest \"$(git ls-files)\" = \"b\"\n '\n \n-test_expect_success 'reset -p' '\n+test_expect_success PERL 'reset -p' '\n \trm .git/index &&\n \tgit add a &&\n \techo y | git reset -p &&\n-- \n1.8.3.4\n"},{"id":"225796","messageId":"20130824195838.GA2960@elie.Belkin","threadId":"34758","inReplyTo":"1377316906-70338-1-git-send-email-draenog@pld-linux.org","subject":"Re: [PATCH 0/3] Fixes for tests run without perl","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-08-24T19:58:38Z","receivedAt":"2013-08-24T19:58:38Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nKacper Kornet wrote:\n\n> This is a set of fixes for problems found while running\n> test suite without perl installed.\n\nI don't think git ever supported that.  The PERL prerequisite\nwas to check for systems that did not have (a suitable) perl\nat runtime, but perl is still pretty heavily used in tests.\n\nI assume you do have perl installed and that these fixes are\nfrom testing the NO_PERL=YesPlease case, which is valuable.\nThanks for working on this.\n\nNow on to the patches.\n\nJonathan\n"},{"id":"225797","messageId":"20130824200128.GB2960@elie.Belkin","threadId":"34758","inReplyTo":"1377316906-70338-2-git-send-email-draenog@pld-linux.org","subject":"Re: [PATCH 1/3] Make test \"using invalid commit with -C\" more strict","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-08-24T20:01:28Z","receivedAt":"2013-08-24T20:01:28Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Kacper Kornet wrote:\n\n> In the test 'using invalid commit with -C' git-commit would have failed\n> even if the -C option  had been given the correct commit, as there was\n> nothing to commit.\n\nGood catch.\n\n[...]\n> --- a/t/t7501-commit.sh\n> +++ b/t/t7501-commit.sh\n> @@ -53,7 +53,10 @@ test_expect_success PERL 'can use paths with --interactive' '\n>  '\n>  \n>  test_expect_success 'using invalid commit with -C' '\n> -\ttest_must_fail git commit -C bogus\n> +\techo bong >file &&\n> +\tgit add file &&\n> +\ttest_must_fail git commit -C bogus &&\n> +\tgit reset\n\nI guess to be pedantic this should say\n\n\techo bong >file &&\n\tgit add file &&\n\ttest_when_finished \"git reset --hard\" &&\n\ttest_must_fail git commit -C bogus\n\nto avoid interfering with later tests even when this one fails and\nthe && prevents the 'git reset' from being executed.\n\nWith or without that change,\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"225798","messageId":"20130824201332.GC2960@elie.Belkin","threadId":"34758","inReplyTo":"1377316906-70338-3-git-send-email-draenog@pld-linux.org","subject":"Re: [PATCH 2/3] t/t3701-add-interactive.sh: Add PERL prerequisite","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-08-24T20:13:32Z","receivedAt":"2013-08-24T20:13:32Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Kacper Kornet wrote:\n\n> --- a/t/t3701-add-interactive.sh\n> +++ b/t/t3701-add-interactive.sh\n> @@ -330,7 +330,7 @@ test_expect_success PERL 'split hunk \"add -p (edit)\"' '\n>  \t! grep \"^+15\" actual\n>  '\n>  \n> -test_expect_success 'patch mode ignores unmerged entries' '\n> +test_expect_success PERL 'patch mode ignores unmerged entries' '\n\nMph.  This is a symptom of f0459319 (change from skip_all=* to prereq\nskip, 2010-08-13), which hurt maintainability without much upside to\nbalance it.\n\nI wonder if it would be easier to do something like the following\ninstead.\n\n-- >8 --\nSubject: add -i test: use skip_all instead of repeated PERL prerequisite\n\nIt is too easy to forget to add the PERL prerequisite for new\n\"add -i\" tests, especially given that many people do not test with\nNO_PERL so the missing prereq is not always noticed quickly.\n\nThe test had used the skip_all mechanism since 1b19ccd2 (2009-04-03)\nbut switched to explicit PERL prereqs in f0459319 (2010-10-13) in hope\nof helping people see how many tests were skipped, perhaps to motivate\nthem to tweak their platform or tests to improve test coverage.  That\ndidn't pan out much in practice, so let's move back to the simpler\nskip_all method.\n\nReported-by: Kacper Kornet <draenog@pld-linux.org>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t3701-add-interactive.sh | 76 +++++++++++++++++++++++++---------------------\n 1 file changed, 41 insertions(+), 35 deletions(-)\n\ndiff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh\nindex 9fab25cc..9dc91d09 100755\n--- a/t/t3701-add-interactive.sh\n+++ b/t/t3701-add-interactive.sh\n@@ -4,18 +4,24 @@ test_description='add -i basic tests'\n . ./test-lib.sh\n . \"$TEST_DIRECTORY\"/lib-prereq-FILEMODE.sh\n \n-test_expect_success PERL 'setup (initial)' '\n+if ! test_have_prereq PERL\n+then\n+\tskip_all='skipping add -i tests, perl not available'\n+\ttest_done\n+fi\n+\n+test_expect_success 'setup (initial)' '\n \techo content >file &&\n \tgit add file &&\n \techo more >>file &&\n \techo lines >>file\n '\n-test_expect_success PERL 'status works (initial)' '\n+test_expect_success 'status works (initial)' '\n \tgit add -i </dev/null >output &&\n \tgrep \"+1/-0 *+2/-0 file\" output\n '\n \n-test_expect_success PERL 'setup expected' '\n+test_expect_success 'setup expected' '\n cat >expected <<EOF\n new file mode 100644\n index 0000000..d95f3ad\n@@ -26,19 +32,19 @@ index 0000000..d95f3ad\n EOF\n '\n \n-test_expect_success PERL 'diff works (initial)' '\n+test_expect_success 'diff works (initial)' '\n \t(echo d; echo 1) | git add -i >output &&\n \tsed -ne \"/new file/,/content/p\" <output >diff &&\n \ttest_cmp expected diff\n '\n-test_expect_success PERL 'revert works (initial)' '\n+test_expect_success 'revert works (initial)' '\n \tgit add file &&\n \t(echo r; echo 1) | git add -i &&\n \tgit ls-files >output &&\n \t! grep . output\n '\n \n-test_expect_success PERL 'setup (commit)' '\n+test_expect_success 'setup (commit)' '\n \techo baseline >file &&\n \tgit add file &&\n \tgit commit -m commit &&\n@@ -47,12 +53,12 @@ test_expect_success PERL 'setup (commit)' '\n \techo more >>file &&\n \techo lines >>file\n '\n-test_expect_success PERL 'status works (commit)' '\n+test_expect_success 'status works (commit)' '\n \tgit add -i </dev/null >output &&\n \tgrep \"+1/-0 *+2/-0 file\" output\n '\n \n-test_expect_success PERL 'setup expected' '\n+test_expect_success 'setup expected' '\n cat >expected <<EOF\n index 180b47c..b6f2c08 100644\n --- a/file\n@@ -63,12 +69,12 @@ index 180b47c..b6f2c08 100644\n EOF\n '\n \n-test_expect_success PERL 'diff works (commit)' '\n+test_expect_success 'diff works (commit)' '\n \t(echo d; echo 1) | git add -i >output &&\n \tsed -ne \"/^index/,/content/p\" <output >diff &&\n \ttest_cmp expected diff\n '\n-test_expect_success PERL 'revert works (commit)' '\n+test_expect_success 'revert works (commit)' '\n \tgit add file &&\n \t(echo r; echo 1) | git add -i &&\n \tgit add -i </dev/null >output &&\n@@ -76,24 +82,24 @@ test_expect_success PERL 'revert works (commit)' '\n '\n \n \n-test_expect_success PERL 'setup expected' '\n+test_expect_success 'setup expected' '\n cat >expected <<EOF\n EOF\n '\n \n-test_expect_success PERL 'setup fake editor' '\n+test_expect_success 'setup fake editor' '\n \t>fake_editor.sh &&\n \tchmod a+x fake_editor.sh &&\n \ttest_set_editor \"$(pwd)/fake_editor.sh\"\n '\n \n-test_expect_success PERL 'dummy edit works' '\n+test_expect_success 'dummy edit works' '\n \t(echo e; echo a) | git add -p &&\n \tgit diff > diff &&\n \ttest_cmp expected diff\n '\n \n-test_expect_success PERL 'setup patch' '\n+test_expect_success 'setup patch' '\n cat >patch <<EOF\n @@ -1,1 +1,4 @@\n  this\n@@ -103,7 +109,7 @@ cat >patch <<EOF\n EOF\n '\n \n-test_expect_success PERL 'setup fake editor' '\n+test_expect_success 'setup fake editor' '\n \techo \"#!$SHELL_PATH\" >fake_editor.sh &&\n \tcat >>fake_editor.sh <<\\EOF &&\n mv -f \"$1\" oldpatch &&\n@@ -113,26 +119,26 @@ EOF\n \ttest_set_editor \"$(pwd)/fake_editor.sh\"\n '\n \n-test_expect_success PERL 'bad edit rejected' '\n+test_expect_success 'bad edit rejected' '\n \tgit reset &&\n \t(echo e; echo n; echo d) | git add -p >output &&\n \tgrep \"hunk does not apply\" output\n '\n \n-test_expect_success PERL 'setup patch' '\n+test_expect_success 'setup patch' '\n cat >patch <<EOF\n this patch\n is garbage\n EOF\n '\n \n-test_expect_success PERL 'garbage edit rejected' '\n+test_expect_success 'garbage edit rejected' '\n \tgit reset &&\n \t(echo e; echo n; echo d) | git add -p >output &&\n \tgrep \"hunk does not apply\" output\n '\n \n-test_expect_success PERL 'setup patch' '\n+test_expect_success 'setup patch' '\n cat >patch <<EOF\n @@ -1,0 +1,0 @@\n  baseline\n@@ -142,7 +148,7 @@ cat >patch <<EOF\n EOF\n '\n \n-test_expect_success PERL 'setup expected' '\n+test_expect_success 'setup expected' '\n cat >expected <<EOF\n diff --git a/file b/file\n index b5dd6c9..f910ae9 100644\n@@ -157,13 +163,13 @@ index b5dd6c9..f910ae9 100644\n EOF\n '\n \n-test_expect_success PERL 'real edit works' '\n+test_expect_success 'real edit works' '\n \t(echo e; echo n; echo d) | git add -p &&\n \tgit diff >output &&\n \ttest_cmp expected output\n '\n \n-test_expect_success PERL 'skip files similarly as commit -a' '\n+test_expect_success 'skip files similarly as commit -a' '\n \tgit reset &&\n \techo file >.gitignore &&\n \techo changed >file &&\n@@ -177,7 +183,7 @@ test_expect_success PERL 'skip files similarly as commit -a' '\n '\n rm -f .gitignore\n \n-test_expect_success PERL,FILEMODE 'patch does not affect mode' '\n+test_expect_success FILEMODE 'patch does not affect mode' '\n \tgit reset --hard &&\n \techo content >>file &&\n \tchmod +x file &&\n@@ -186,7 +192,7 @@ test_expect_success PERL,FILEMODE 'patch does not affect mode' '\n \tgit diff file | grep \"new mode\"\n '\n \n-test_expect_success PERL,FILEMODE 'stage mode but not hunk' '\n+test_expect_success FILEMODE 'stage mode but not hunk' '\n \tgit reset --hard &&\n \techo content >>file &&\n \tchmod +x file &&\n@@ -196,7 +202,7 @@ test_expect_success PERL,FILEMODE 'stage mode but not hunk' '\n '\n \n \n-test_expect_success PERL,FILEMODE 'stage mode and hunk' '\n+test_expect_success FILEMODE 'stage mode and hunk' '\n \tgit reset --hard &&\n \techo content >>file &&\n \tchmod +x file &&\n@@ -208,14 +214,14 @@ test_expect_success PERL,FILEMODE 'stage mode and hunk' '\n \n # end of tests disabled when filemode is not usable\n \n-test_expect_success PERL 'setup again' '\n+test_expect_success 'setup again' '\n \tgit reset --hard &&\n \ttest_chmod +x file &&\n \techo content >>file\n '\n \n # Write the patch file with a new line at the top and bottom\n-test_expect_success PERL 'setup patch' '\n+test_expect_success 'setup patch' '\n cat >patch <<EOF\n index 180b47c..b6f2c08 100644\n --- a/file\n@@ -229,7 +235,7 @@ EOF\n '\n \n # Expected output, similar to the patch but w/ diff at the top\n-test_expect_success PERL 'setup expected' '\n+test_expect_success 'setup expected' '\n cat >expected <<EOF\n diff --git a/file b/file\n index b6f2c08..61b9053 100755\n@@ -244,7 +250,7 @@ EOF\n '\n \n # Test splitting the first patch, then adding both\n-test_expect_success PERL 'add first line works' '\n+test_expect_success 'add first line works' '\n \tgit commit -am \"clear local changes\" &&\n \tgit apply patch &&\n \t(echo s; echo y; echo y) | git add -p file &&\n@@ -252,7 +258,7 @@ test_expect_success PERL 'add first line works' '\n \ttest_cmp expected diff\n '\n \n-test_expect_success PERL 'setup expected' '\n+test_expect_success 'setup expected' '\n cat >expected <<EOF\n diff --git a/non-empty b/non-empty\n deleted file mode 100644\n@@ -264,7 +270,7 @@ index d95f3ad..0000000\n EOF\n '\n \n-test_expect_success PERL 'deleting a non-empty file' '\n+test_expect_success 'deleting a non-empty file' '\n \tgit reset --hard &&\n \techo content >non-empty &&\n \tgit add non-empty &&\n@@ -275,7 +281,7 @@ test_expect_success PERL 'deleting a non-empty file' '\n \ttest_cmp expected diff\n '\n \n-test_expect_success PERL 'setup expected' '\n+test_expect_success 'setup expected' '\n cat >expected <<EOF\n diff --git a/empty b/empty\n deleted file mode 100644\n@@ -283,7 +289,7 @@ index e69de29..0000000\n EOF\n '\n \n-test_expect_success PERL 'deleting an empty file' '\n+test_expect_success 'deleting an empty file' '\n \tgit reset --hard &&\n \t> empty &&\n \tgit add empty &&\n@@ -294,7 +300,7 @@ test_expect_success PERL 'deleting an empty file' '\n \ttest_cmp expected diff\n '\n \n-test_expect_success PERL 'split hunk setup' '\n+test_expect_success 'split hunk setup' '\n \tgit reset --hard &&\n \tfor i in 10 20 30 40 50 60\n \tdo\n@@ -310,7 +316,7 @@ test_expect_success PERL 'split hunk setup' '\n \tdone >test\n '\n \n-test_expect_success PERL 'split hunk \"add -p (edit)\"' '\n+test_expect_success 'split hunk \"add -p (edit)\"' '\n \t# Split, say Edit and do nothing.  Then:\n \t#\n \t# 1. Broken version results in a patch that does not apply and\n-- \n1.8.4.rc4\n"},{"id":"225799","messageId":"20130824203414.GD2960@elie.Belkin","threadId":"34758","inReplyTo":"1377316906-70338-4-git-send-email-draenog@pld-linux.org","subject":"Re: [PATCH 3/3] t/t7106-reset-unborn-branch.sh: Add PERL prerequisite","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-08-24T20:34:14Z","receivedAt":"2013-08-24T20:34:14Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Kacper Kornet wrote:\n\n> Signed-off-by: Kacper Kornet <draenog@pld-linux.org>\n\nThanks.\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nHere's a style cleanup on top.\n\n-- >8 --\nSubject: reset test: modernize style\n\nAvoid command substitution and pipes to ensure that the exit status\nfrom each git command is tested (and in particular that any segfaults\nare caught).\n\nMaintain the test setup (no commits, one file named \"a\", another named\n\"b\") even after the last test, to make it easier to rearrange tests or\nadd new tests after the last in the future.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t7106-reset-unborn-branch.sh | 31 ++++++++++++++++++++++++-------\n 1 file changed, 24 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t7106-reset-unborn-branch.sh b/t/t7106-reset-unborn-branch.sh\nindex 499cd88c..af00ab4d 100755\n--- a/t/t7106-reset-unborn-branch.sh\n+++ b/t/t7106-reset-unborn-branch.sh\n@@ -11,7 +11,10 @@ test_expect_success 'setup' '\n test_expect_success 'reset' '\n \tgit add a b &&\n \tgit reset &&\n-\ttest \"$(git ls-files)\" = \"\"\n+\n+\t>expect &&\n+\tgit ls-files >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'reset HEAD' '\n@@ -24,28 +27,42 @@ test_expect_success 'reset $file' '\n \trm .git/index &&\n \tgit add a b &&\n \tgit reset a &&\n-\ttest \"$(git ls-files)\" = \"b\"\n+\n+\techo b >expect &&\n+\tgit ls-files >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success PERL 'reset -p' '\n \trm .git/index &&\n \tgit add a &&\n-\techo y | git reset -p &&\n-\ttest \"$(git ls-files)\" = \"\"\n+\techo y >yes &&\n+\tgit reset -p <yes &&\n+\n+\t>expect &&\n+\tgit ls-files >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'reset --soft is a no-op' '\n \trm .git/index &&\n \tgit add a &&\n-\tgit reset --soft\n-\ttest \"$(git ls-files)\" = \"a\"\n+\tgit reset --soft &&\n+\n+\techo a >expect &&\n+\tgit ls-files >actual &&\n+\ttest_cmp expect actual\n '\n \n test_expect_success 'reset --hard' '\n \trm .git/index &&\n \tgit add a &&\n+\ttest_when_finished \"echo a >a\" &&\n \tgit reset --hard &&\n-\ttest \"$(git ls-files)\" = \"\" &&\n+\n+\t>expect &&\n+\tgit ls-files >actual &&\n+\ttest_cmp expect actual &&\n \ttest_path_is_missing a\n '\n \n-- \n1.8.4.rc4\n"},{"id":"225838","messageId":"xmqqfvtyl1gm.fsf@gitster.dls.corp.google.com","threadId":"34758","inReplyTo":"20130824200128.GB2960@elie.Belkin","subject":"Re: [PATCH 1/3] Make test \"using invalid commit with -C\" more strict","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-25T06:38:17Z","receivedAt":"2013-08-25T06:38:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Kacper Kornet wrote:\n>\n>> In the test 'using invalid commit with -C' git-commit would have failed\n>> even if the -C option  had been given the correct commit, as there was\n>> nothing to commit.\n>\n> Good catch.\n>\n> [...]\n>> --- a/t/t7501-commit.sh\n>> +++ b/t/t7501-commit.sh\n>> @@ -53,7 +53,10 @@ test_expect_success PERL 'can use paths with --interactive' '\n>>  '\n>>  \n>>  test_expect_success 'using invalid commit with -C' '\n>> -\ttest_must_fail git commit -C bogus\n>> +\techo bong >file &&\n>> +\tgit add file &&\n>> +\ttest_must_fail git commit -C bogus &&\n>> +\tgit reset\n>\n> I guess to be pedantic this should say\n>\n> \techo bong >file &&\n> \tgit add file &&\n> \ttest_when_finished \"git reset --hard\" &&\n> \ttest_must_fail git commit -C bogus\n>\n> to avoid interfering with later tests even when this one fails and\n> the && prevents the 'git reset' from being executed.\n\nMakes sense.\n\nAlso it would be much simpler to say \"git commit --allow-empty\".\n"},{"id":"225839","messageId":"20130825064041.GT2882@elie.Belkin","threadId":"34758","inReplyTo":"xmqqfvtyl1gm.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 1/3] Make test \"using invalid commit with -C\" more strict","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-08-25T06:40:41Z","receivedAt":"2013-08-25T06:40:41Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n>> Kacper Kornet wrote:\n\n>>> In the test 'using invalid commit with -C' git-commit would have failed\n>>> even if the -C option  had been given the correct commit, as there was\n>>> nothing to commit.\n[...]\n> Also it would be much simpler to say \"git commit --allow-empty\".\n\nSounds good. ;-)\n\nThanks,\nJonathan\n"},{"id":"225840","messageId":"xmqq8uzql0vr.fsf@gitster.dls.corp.google.com","threadId":"34758","inReplyTo":"20130824203414.GD2960@elie.Belkin","subject":"Re: [PATCH 3/3] t/t7106-reset-unborn-branch.sh: Add PERL prerequisite","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-08-25T06:50:48Z","receivedAt":"2013-08-25T06:50:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Kacper Kornet wrote:\n>\n>> Signed-off-by: Kacper Kornet <draenog@pld-linux.org>\n>\n> Thanks.\n>\n> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n>\n> Here's a style cleanup on top.\n>\n> -- >8 --\n> Subject: reset test: modernize style\n>\n> Avoid command substitution and pipes to ensure that the exit status\n> from each git command is tested (and in particular that any segfaults\n> are caught).\n\nMakes sense.\n\nThe change to the one that feeds 'y' to \"reset -p\" may be a bit too\npedantic, as we are not in the business of testing \"echo y\", though.\n\n> Maintain the test setup (no commits, one file named \"a\", another named\n> \"b\") even after the last test, to make it easier to rearrange tests or\n> add new tests after the last in the future.\n>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n>  t/t7106-reset-unborn-branch.sh | 31 ++++++++++++++++++++++++-------\n>  1 file changed, 24 insertions(+), 7 deletions(-)\n>\n> diff --git a/t/t7106-reset-unborn-branch.sh b/t/t7106-reset-unborn-branch.sh\n> index 499cd88c..af00ab4d 100755\n> --- a/t/t7106-reset-unborn-branch.sh\n> +++ b/t/t7106-reset-unborn-branch.sh\n> @@ -11,7 +11,10 @@ test_expect_success 'setup' '\n>  test_expect_success 'reset' '\n>  \tgit add a b &&\n>  \tgit reset &&\n> -\ttest \"$(git ls-files)\" = \"\"\n> +\n> +\t>expect &&\n> +\tgit ls-files >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success 'reset HEAD' '\n> @@ -24,28 +27,42 @@ test_expect_success 'reset $file' '\n>  \trm .git/index &&\n>  \tgit add a b &&\n>  \tgit reset a &&\n> -\ttest \"$(git ls-files)\" = \"b\"\n> +\n> +\techo b >expect &&\n> +\tgit ls-files >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success PERL 'reset -p' '\n>  \trm .git/index &&\n>  \tgit add a &&\n> -\techo y | git reset -p &&\n> -\ttest \"$(git ls-files)\" = \"\"\n> +\techo y >yes &&\n> +\tgit reset -p <yes &&\n> +\n> +\t>expect &&\n> +\tgit ls-files >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success 'reset --soft is a no-op' '\n>  \trm .git/index &&\n>  \tgit add a &&\n> -\tgit reset --soft\n> -\ttest \"$(git ls-files)\" = \"a\"\n> +\tgit reset --soft &&\n> +\n> +\techo a >expect &&\n> +\tgit ls-files >actual &&\n> +\ttest_cmp expect actual\n>  '\n>  \n>  test_expect_success 'reset --hard' '\n>  \trm .git/index &&\n>  \tgit add a &&\n> +\ttest_when_finished \"echo a >a\" &&\n>  \tgit reset --hard &&\n> -\ttest \"$(git ls-files)\" = \"\" &&\n> +\n> +\t>expect &&\n> +\tgit ls-files >actual &&\n> +\ttest_cmp expect actual &&\n>  \ttest_path_is_missing a\n>  '\n"},{"id":"225841","messageId":"20130825070911.GU2882@elie.Belkin","threadId":"34758","inReplyTo":"xmqq8uzql0vr.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 3/3] t/t7106-reset-unborn-branch.sh: Add PERL prerequisite","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-08-25T07:09:11Z","receivedAt":"2013-08-25T07:09:11Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> The change to the one that feeds 'y' to \"reset -p\" may be a bit too\n> pedantic, as we are not in the business of testing \"echo y\", though.\n\nYeah, that's true.  Here's a patch for squashing in.\n\ndiff --git i/t/t7106-reset-unborn-branch.sh w/t/t7106-reset-unborn-branch.sh\nindex af00ab4d..bd28feba 100755\n--- i/t/t7106-reset-unborn-branch.sh\n+++ w/t/t7106-reset-unborn-branch.sh\n@@ -12,9 +12,8 @@ test_expect_success 'reset' '\n \tgit add a b &&\n \tgit reset &&\n \n-\t>expect &&\n \tgit ls-files >actual &&\n-\ttest_cmp expect actual\n+\ttest_must_be_empty actual\n '\n \n test_expect_success 'reset HEAD' '\n@@ -36,12 +35,10 @@ test_expect_success 'reset $file' '\n test_expect_success PERL 'reset -p' '\n \trm .git/index &&\n \tgit add a &&\n-\techo y >yes &&\n-\tgit reset -p <yes &&\n+\techo y | git reset -p &&\n \n-\t>expect &&\n \tgit ls-files >actual &&\n-\ttest_cmp expect actual\n+\ttest_must_be_empty actual\n '\n \n test_expect_success 'reset --soft is a no-op' '\n@@ -60,9 +57,8 @@ test_expect_success 'reset --hard' '\n \ttest_when_finished \"echo a >a\" &&\n \tgit reset --hard &&\n \n-\t>expect &&\n \tgit ls-files >actual &&\n-\ttest_cmp expect actual &&\n+\ttest_must_be_empty actual &&\n \ttest_path_is_missing a\n '\n \n"}]}