{"thread":{"id":"42964","subject":"[PATCH v2 1/3] Enhance test t3700-add.sh","startedAt":"2016-07-29T21:19:23Z","lastAt":"2016-07-29T21:57:33Z","messageCount":2,"participants":["Ingo Brückl","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":3},"messages":[{"id":"292560","messageId":"579bc6ca.10e2ad4d.bm000@wupperonline.de","threadId":"42964","inReplyTo":null,"subject":"[PATCH v2 1/3] Enhance test t3700-add.sh","fromName":"Ingo Brückl","fromEmail":"ib@wupperonline.de","sentAt":"2016-07-29T21:09:52Z","receivedAt":"2016-07-29T21:19:23Z","isPatch":true,"sender":{"key":"ib@wupperonline.de","avatar":"https://avatars.githubusercontent.com/u/123327?v=4"},"body":"The files to be tested may already exist and be links which will make\nthe test fail. So ensure that we are working in a clean environment.\n\nSigned-off-by: Ingo Brückl <ib@wupperonline.de>\n---\n t/t3700-add.sh | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex 4865304..494f5b8 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -333,6 +333,7 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file out\n '\n\n test_expect_success 'git add --chmod=+x stages a non-executable file with +x' '\n+\trm -f foo1 &&\n \techo foo >foo1 &&\n \tgit add --chmod=+x foo1 &&\n \tcase \"$(git ls-files --stage foo1)\" in\n@@ -342,6 +343,7 @@ test_expect_success 'git add --chmod=+x stages a non-executable file with +x' '\n '\n\n test_expect_success 'git add --chmod=-x stages an executable file with -x' '\n+\trm -f xfoo1 &&\n \techo foo >xfoo1 &&\n \tchmod 755 xfoo1 &&\n \tgit add --chmod=-x xfoo1 &&\n@@ -354,6 +356,7 @@ test_expect_success 'git add --chmod=-x stages an executable file with -x' '\n test_expect_success POSIXPERM,SYMLINKS 'git add --chmod=+x with symlinks' '\n \tgit config core.filemode 1 &&\n \tgit config core.symlinks 1 &&\n+\trm -f foo2 &&\n \techo foo >foo2 &&\n \tgit add --chmod=+x foo2 &&\n \tcase \"$(git ls-files --stage foo2)\" in\n--\n2.9.2\n\n"},{"id":"292565","messageId":"xmqq60rom7jv.fsf@gitster.mtv.corp.google.com","threadId":"42964","inReplyTo":"579bc6ca.10e2ad4d.bm000@wupperonline.de","subject":"Re: [PATCH v2 1/3] Enhance test t3700-add.sh","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-07-29T21:57:24Z","receivedAt":"2016-07-29T21:57:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ingo Brückl <ib@wupperonline.de> writes:\n\n> Subject: Re: [PATCH v2 1/3] Enhance test t3700-add.sh\n>\n> The files to be tested may already exist and be links which will make\n> the test fail. So ensure that we are working in a clean environment.\n\n\"Enhance\", like \"Update\" or \"Change\", is a more-or-less useless\nnoiseword in a commit title; it does not say much about in what way\nit was enhanced.\n\nIf we clarify the body of the explanation, a better word emerges, I\nwould think.  How about this instead?\n\n\tt3700: remove unwanted leftover files before running new tests\n\n\tWhen an earlier test that has prerequisite is skipped, files\n\tused by later tests may be left in the working tree in an\n\tunexpected state.  For example, a test runs this sequence:\n\n\t\techo foo >xfoo1 && chmod 755 xfoo1\n\n\tto create an executable file xfoo1, expecting that xfoo1\n\tdoes not exist before it runs in the test sequence.\n\tHowever, the absense of this file depends on \"git reset\n\t--hard\" done in an earlier test, that is skipped when SANITY\n\tprerequisite is not met, and worse yet, xfoo1 originally is\n\tcreated as a symbolic link, which means the chmod does not\n\taffect the modes of xfoo1 as this test expects.\n\n\tFix this by starting the test with \"rm -f xfoo1\" to make\n\tsure the file is created from scratch, and do the same to\n\tother similar tests.\n\n>\n> Signed-off-by: Ingo Brückl <ib@wupperonline.de>\n> ---\n>  t/t3700-add.sh | 3 +++\n>  1 file changed, 3 insertions(+)\n>\n> diff --git a/t/t3700-add.sh b/t/t3700-add.sh\n> index 4865304..494f5b8 100755\n> --- a/t/t3700-add.sh\n> +++ b/t/t3700-add.sh\n> @@ -333,6 +333,7 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file out\n>  '\n>\n>  test_expect_success 'git add --chmod=+x stages a non-executable file with +x' '\n> +\trm -f foo1 &&\n>  \techo foo >foo1 &&\n>  \tgit add --chmod=+x foo1 &&\n>  \tcase \"$(git ls-files --stage foo1)\" in\n> @@ -342,6 +343,7 @@ test_expect_success 'git add --chmod=+x stages a non-executable file with +x' '\n>  '\n>\n>  test_expect_success 'git add --chmod=-x stages an executable file with -x' '\n> +\trm -f xfoo1 &&\n>  \techo foo >xfoo1 &&\n>  \tchmod 755 xfoo1 &&\n>  \tgit add --chmod=-x xfoo1 &&\n> @@ -354,6 +356,7 @@ test_expect_success 'git add --chmod=-x stages an executable file with -x' '\n>  test_expect_success POSIXPERM,SYMLINKS 'git add --chmod=+x with symlinks' '\n>  \tgit config core.filemode 1 &&\n>  \tgit config core.symlinks 1 &&\n> +\trm -f foo2 &&\n>  \techo foo >foo2 &&\n>  \tgit add --chmod=+x foo2 &&\n>  \tcase \"$(git ls-files --stage foo2)\" in\n> --\n> 2.9.2\n"}]}