git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t3600: fix broken "choking git rm" test

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Oct 16, 2013, 00:38 UTC
Message-ID
<20131016003846.GU19704@goldbirke>
In-Reply-To
<20131016001804.GJ9464@google.com>
On Tue, Oct 15, 2013 at 05:18:04PM -0700, Jonathan Nieder wrote:
Show 11 quoted lines
> SZEDER Gábor wrote:
> > --- a/t/t3600-rm.sh
> > +++ b/t/t3600-rm.sh
> > @@ -240,18 +240,15 @@ test_expect_success 'refresh index before checking if it is up-to-date' '
> >  
> >  test_expect_success 'choking "git rm" should not let it die with cruft' '
> >  	git reset -q --hard &&
> > +	test_when_finished "rm -f .git/index.lock ; git reset -q --hard" &&
> 
> I'd use "&&" here --- the test_cleanup checks the exit status from
> this scriptlet, so it's a good habit.

OK. My motivation for the ';' was that we should make sure that both steps of the cleanup are executed. However, now thinking about it if regular 'rm -f' can't remove the lock file then all bets are off anyway.

Show 13 quoted lines
> [...]
> > -	test -f .git/index.lock
> > -	status=$?
> > -	rm -f .git/index.lock
> > -	git reset -q --hard
> > -	test "$status" != 0
> > +	test ! -f .git/index.lock
> 
> Gah.  Thanks for cleaning it up.
> 
> Maybe test_path_is_missing would make sense here?  (It would notice a
> .git/index.lock directory, which is not very likely :), but more
> importantly, it says why it is failing the test when it fails.)

I was not aware of the test_path_is_missing helper. I don't think it matters whether it's a file or a directory, because a stale .git/index.lock directory would be just as bad.

Previous: Jonathan Nieder
Message 3 of 3 in “t3600: fix broken "choking git rm" test”
  1. t3600: fix broken "choking git rm" testSZEDER Gábor, Oct 16, 2013
  2. Jonathan NiederOct 16, 2013
  3. SZEDER GáborOct 16, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.