Web lists-archives.com

Re: [PATCH] t6500: don't run detached auto gc at the end of the test script

On Mon, Apr 10, 2017 at 06:31:54PM +0200, SZEDER Gábor wrote:

> Indeed this seems to work, and luckily we don't need that much
> hackery.  When there is a single variable assignment and the expansion
> of a command substitution is assigned to the variable, then the exit
> status is that of the command inside the command substitution, i.e.
>   $ v=$(false) ; echo $?
>   1
> This means we can write this simply as:
>   doesnt_matter=$(git gc --auto 9>&1)
> It's still hackery :)

Heh. Yeah, I would call that _more_ hackery in that it's much more
clever. But it is shorter. :)

I think as long as the trickery is documented that's OK (and calling it
doesnt_matter and explaining in the commit message is fine by me;
hopefully that name would induce somebody to look in the history).

> OTOH, this makes it possible to continue the test reliably after the
> gc finished in the background, so we could also check that there is
> only a single pack file left, i.e. that the detached gc did what it
> was supposed to do.

Yes, I think the test can and should check the after-gc state.