From: Junio C Hamano <gitster@pobox.com>
To: Jeremy Huddleston Sequoia <jeremyhu@freedesktop.org>
Cc: t.gummerer@gmail.com, git@vger.kernel.org
Subject: Re: git 2.10.1 test regression in t3700-add.sh
Date: Tue, 11 Oct 2016 22:59:15 -0700 [thread overview]
Message-ID: <xmqq1szm6rbg.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <EF7F9B45-867A-433B-9623-EBBF33D34793@freedesktop.org> (Jeremy Huddleston Sequoia's message of "Tue, 11 Oct 2016 16:32:51 -0700")
Jeremy Huddleston Sequoia <jeremyhu@freedesktop.org> writes:
>> diff --git a/t/t3700-add.sh b/t/t3700-add.sh
>> index 924a266126..53c0cb6dea 100755
>> --- a/t/t3700-add.sh
>> +++ b/t/t3700-add.sh
>> @@ -350,6 +350,7 @@ test_expect_success POSIXPERM,SYMLINKS 'git add --chmod=+x with symlinks' '
>> '
>>
>> test_expect_success 'git add --chmod=[+-]x changes index with already added file' '
>> + rm -f foo3 xfoo3 &&
>> echo foo >foo3 &&
>> git add foo3 &&
>> git add --chmod=+x foo3 &&
>
>
> I actually tried that, but the problem is that xfoo3 was
> previously added as a symlink, so test_mode_in_index still reports
> it as a symlink.
Ah, of course. That "rm -f" needs to remove from the index and also
from the working tree, so has to be "git rm -f --ignore-unmatch" or
something like that.
> It's fundamentally a question of who is responsible for cleanup.
> Is the individual test responsible for cleaning up after itself
> (such that later tests can rely on a clean state), or should
> individual tests assume that the initial state might be undefined
> and try to cleanup after earlier tests?
In modern tests, we strive to do the former with liberal use of
test_when_finished. I think the one that creates xfoo[123] and
leaves them behind for a long time predates the modern practice.
A minimal fix with that approach may look like this:
t/t3700-add.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index 924a266126..80c7ee3e3b 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -64,6 +64,7 @@ test_expect_success 'git add: filemode=0 should not get confused by symlink' '
test_expect_success \
'git update-index --add: Test that executable bit is not used...' \
'git config core.filemode 0 &&
+ test_when_finished "git rm -f xfoo3" &&
test_ln_s_add xfoo2 xfoo3 && # runs git update-index --add
test_mode_in_index 120000 xfoo3'
prev parent reply other threads:[~2016-10-12 6:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-10 0:15 git 2.10.1 test regression in t3700-add.sh Jeremy Huddleston Sequoia
2016-10-10 2:51 ` Jeremy Huddleston Sequoia
2016-10-10 3:22 ` Jeremy Huddleston Sequoia
2016-10-10 3:46 ` Jeremy Huddleston Sequoia
2016-10-10 17:41 ` Junio C Hamano
2016-10-10 17:46 ` Junio C Hamano
2016-10-10 19:14 ` Johannes Sixt
2016-10-11 23:32 ` Jeremy Huddleston Sequoia
2016-10-12 5:59 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq1szm6rbg.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jeremyhu@freedesktop.org \
--cc=t.gummerer@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).