# [PATCH] t3700-add.sh: Avoid filename collission between tests which could lead to test failure

3 messages from 2016-10-10 to 2016-10-10. Participants: Jeremy Huddleston Sequoia, Junio C Hamano.
Thread: https://gitlist.dev/t/44267

## Jeremy Huddleston Sequoia, 2016-10-10 03:57

Subject: [PATCH] t3700-add.sh: Avoid filename collission between tests which could lead to test failure
Message-ID: <20161010035756.38408-1-jeremyhu@apple.com>
URL: https://gitlist.dev/e/20161010035756.38408-1-jeremyhu%40apple.com

```
Regressed-in: 610d55af0f082f6b866dc858e144c03d8ed4424c
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
CC: Thomas Gummerer <t.gummerer@gmail.com>
CC: Junio C Hamano <gitster@pobox.com>
---
 t/t3700-add.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 924a266..3ccb19b 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -354,11 +354,11 @@ test_expect_success 'git add --chmod=[+-]x changes index with already added file
 	git add foo3 &&
 	git add --chmod=+x foo3 &&
 	test_mode_in_index 100755 foo3 &&
-	echo foo >xfoo3 &&
-	chmod 755 xfoo3 &&
-	git add xfoo3 &&
-	git add --chmod=-x xfoo3 &&
-	test_mode_in_index 100644 xfoo3
+	echo foo >xfoo4 &&
+	chmod 755 xfoo4 &&
+	git add xfoo4 &&
+	git add --chmod=-x xfoo4 &&
+	test_mode_in_index 100644 xfoo4
 '
 
 test_expect_success POSIXPERM 'git add --chmod=[+-]x does not change the working tree' '
-- 
2.10.1


```

## Junio C Hamano, 2016-10-10 16:44

Subject: Re: [PATCH] t3700-add.sh: Avoid filename collission between tests which could lead to test failure
Message-ID: <xmqqlgxwgnmu.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqlgxwgnmu.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20161010035756.38408-1-jeremyhu@apple.com>

```
Jeremy Huddleston Sequoia <jeremyhu@apple.com> writes:

> Regressed-in: 610d55af0f082f6b866dc858e144c03d8ed4424c
> Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
> CC: Thomas Gummerer <t.gummerer@gmail.com>
> CC: Junio C Hamano <gitster@pobox.com>

This is also under-explained.  Was the test broken for everybody and
you are the first to report, or was your environment somehow different
that the existing problem was revealed there first?


```

## Jeremy Huddleston Sequoia, 2016-10-10 17:09

Subject: Re: [PATCH] t3700-add.sh: Avoid filename collission between tests which could lead to test failure
Message-ID: <D7AF680C-1BED-431C-980E-5895B3848815@apple.com>
URL: https://gitlist.dev/e/D7AF680C-1BED-431C-980E-5895B3848815%40apple.com
In-Reply-To: <xmqqlgxwgnmu.fsf@gitster.mtv.corp.google.com>

```

> On Oct 10, 2016, at 09:44, Junio C Hamano <gitster@pobox.com> wrote:
> 
> Jeremy Huddleston Sequoia <jeremyhu@apple.com> writes:
> 
>> Regressed-in: 610d55af0f082f6b866dc858e144c03d8ed4424c
>> Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
>> CC: Thomas Gummerer <t.gummerer@gmail.com>
>> CC: Junio C Hamano <gitster@pobox.com>
> 
> This is also under-explained.  Was the test broken for everybody and
> you are the first to report, or was your environment somehow different
> that the existing problem was revealed there first?

There is nothing obviously different about my environment.  I'd expect this test to fail for everyone that runs the entire test because xfoo3 is not cleaned up after this earlier test:

test_expect_success \
        'git update-index --add: Test that executable bit is not used...' \
        'git config core.filemode 0 &&
         test_ln_s_add xfoo2 xfoo3 &&   # runs git update-index --add
         test_mode_in_index 120000 xfoo3'

If anyone ran the test by itself or otherwise skipped the 'git update-index --add: Test that executable bit is not used...' test, they would not encounter the issue.  However, the normal case is to run all of the tests, so I would expect everyone to be tripping over this issue.  If they're not, then that itself might be indicative of another bug because clearly that previous test just added xfoo3 as a symlink.

--Jeremy
```
