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

Re: [PATCH 2/6] t5400: allow individual tests to fail

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 9, 2009, 19:08 UTC
Message-ID
<7v4oz3v36a.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20090209184625.GA27037@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 72 quoted lines
> On Mon, Feb 09, 2009 at 01:09:21AM -0800, Junio C Hamano wrote:
>
>> Each test chdir'ed around and ended up in a random place if any of the
>> test in the sequence failed but the entire test script was allowed to
>> run.  This wrapps each in a subshell as necessary.
>
> Certainly a good cleanup, but...
>
>> -test_expect_success \
>> -        'push can be used to delete a ref' '
>> +test_expect_success 'push can be used to delete a ref' '
>> +    (
>>  	cd victim &&
>>  	git branch extra master &&
>>  	cd .. &&
>>  	test -f victim/.git/refs/heads/extra &&
>>  	git send-pack ./victim/.git/ :extra master &&
>>  	! test -f victim/.git/refs/heads/extra
>> +    )
>>  '
>
> Wouldn't this be cleaner as:
>
>   (
>     cd victim &&
>     git branch extra master
>   ) &&
>   ...
>
> That is, it is not only safer but (IMHO) a bit easier to see which parts
> are happening in which directory.
>
>> +test_expect_success 'pushing a delete should be denied with denyDeletes' '
>> +    (
>>  	cd victim &&
>>  	git config receive.denyDeletes true &&
>>  	git branch extra master &&
>>  	cd .. &&
>>  	test -f victim/.git/refs/heads/extra &&
>>  	test_must_fail git send-pack ./victim/.git/ :extra master
>> +    )
>
> Ditto (and there are more, but I won't quote each one).
>
>> +test_expect_success 'pushing with --force should be denied with denyNonFastforwards' '
>> +    (
>>  	cd victim &&
>>  	git config receive.denyNonFastforwards true &&
>>  	cd .. &&
>>  	git update-ref refs/heads/master master^ || return 1
>>  	git send-pack --force ./victim/.git/ master && return 1
>>  	! test_cmp .git/refs/heads/master victim/.git/refs/heads/master
>> +    )
>
> And here I don't know what in the world is going on with those "return
> 1" lines. Shouldn't this be a chain of &&'s with a test_must_fail?
> I.e.,:
>
>   ( cd victim && git config receive.denyNonFastforwards true ) &&
>   git update-ref refs/heads/master master^ &&
>   test_must_fail git send-pack --force ./victim/.git/ master &&
>   ! test_cmp .git/refs/heads/master victim/.git/refs/heads/master
>
> Not to mention that the final test_cmp would be more robust if written
> to make sure the victim's master ref stayed the same (instead of just
> making sure we didn't screw it up in one particular way). And it should
> probably use a git command rather than looking at the refs files (to be
> future-proof against any automatic ref-packing), but that is just
> nit-picking.
>
>
> All minor things, of course, but while we're cleaning up... :)

Sure. This was made as a quick-fix to a mess others created, so I did not study them very deeply.

Will reroll if I have the time but it is likely that I may be tending other topics first.

Previous: Jeff KingNext: Junio C Hamano
Message 25 of 29 in “Deleting the "current" branch in remote bare repositories”
  1. Jan KrügerFeb 7, 2009
  2. Felipe ContrerasFeb 7, 2009
  3. Jan KrügerFeb 8, 2009
  4. Jeff KingFeb 8, 2009
  5. Junio C HamanoFeb 8, 2009
  6. Jeff KingFeb 8, 2009
  7. Junio C HamanoFeb 8, 2009
  8. 0/6 Deleting the "current" branch in a remote repositoryJunio C Hamano, Feb 9, 2009
  9. 1/6 builtin-receive-pack.c: do not initialize statics to 0Junio C Hamano, Feb 9, 2009
  10. 2/6 t5400: allow individual tests to failJunio C Hamano, Feb 9, 2009
  11. 3/6 receive-pack: receive.denyDeleteCurrentJunio C Hamano, Feb 9, 2009
  12. 4/6 remote prune: warn dangling symrefsJunio C Hamano, Feb 9, 2009
  13. 5/6 Warn use of "origin" when remotes/origin/HEAD is danglingJunio C Hamano, Feb 9, 2009
  14. 6/6 receive-pack: default receive.denyDeleteCurrent to refuseJunio C Hamano, Feb 9, 2009
  15. Jeff KingFeb 9, 2009
  16. Junio C HamanoFeb 11, 2009
  17. Jeff KingFeb 11, 2009
  18. Jeff KingFeb 11, 2009
  19. Jeff KingFeb 9, 2009
  20. Jeff KingFeb 9, 2009
  21. Junio C HamanoFeb 9, 2009
  22. Jeff KingFeb 10, 2009
  23. Junio C HamanoFeb 10, 2009
  24. Jeff KingFeb 9, 2009
  25. Junio C HamanoFeb 9, 2009
  26. Junio C HamanoFeb 9, 2009
  27. Jeff KingFeb 10, 2009
  28. Jeff KingFeb 9, 2009
  29. Jeff KingFeb 9, 2009

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.