{"thread":{"id":"42977","subject":"[PATCH v3 1/3] t3700: remove unwanted leftover files before running new tests","startedAt":"2016-07-30T20:20:06Z","lastAt":"2016-07-30T20:20:06Z","messageCount":1,"participants":["Ingo Brückl"],"isPatch":true,"patchVersion":3,"patchTotal":3},"messages":[{"id":"292663","messageId":"579d0a83.02cb01fa.bm000@wupperonline.de","threadId":"42977","inReplyTo":null,"subject":"[PATCH v3 1/3] t3700: remove unwanted leftover files before running new tests","fromName":"Ingo Brückl","fromEmail":"ib@wupperonline.de","sentAt":"2016-07-30T20:13:38Z","receivedAt":"2016-07-30T20:20:06Z","isPatch":true,"sender":{"key":"ib@wupperonline.de","avatar":"https://avatars.githubusercontent.com/u/123327?v=4"},"body":"When an earlier test that has prerequisite is skipped, files\nused by later tests may be left in the working tree in an\nunexpected state.  For example, a test runs this sequence:\n\n        echo foo >xfoo1 && chmod 755 xfoo1\n\nto create an executable file xfoo1, expecting that xfoo1\ndoes not exist before it runs in the test sequence.\nHowever, the absence of this file depends on \"git reset\n--hard\" done in an earlier test, that is skipped when SANITY\nprerequisite is not met, and worse yet, xfoo1 originally is\ncreated as a symbolic link, which means the chmod does not\naffect the modes of xfoo1 as this test expects.\n\nFix this by starting the test with \"rm -f xfoo1\" to make\nsure the file is created from scratch, and do the same to\nother similar tests.\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"}]}