Re: [PATCH 2/3] bisect: add tests for bisection on bare repositories
- From
Jon Seymour <jon.seymour@gmail.com>
- Date
- Aug 7, 2011, 14:39 UTC
- Message-ID
- <CAH3AnrohGgvu+B-p2-4kNcx68UV4tAbirz7gf6Qi9=WpGqE+3Q@mail.gmail.com>
- In-Reply-To
- <20110807133939.GA10748@elie.gateway.2wire.net>
On Sun, Aug 7, 2011 at 11:39 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 36 quoted lines
> Jon Seymour wrote: > >> We add a test to check that bisection works on bare repositories >> both when --no-checkout is specified explicitly and when it >> is defaulted. > > Yay! > >> --- a/t/t6030-bisect-porcelain.sh >> +++ b/t/t6030-bisect-porcelain.sh >> @@ -592,6 +592,34 @@ test_expect_success 'erroring out when using bad path parameters' ' >> grep "bad path parameters" error.txt >> ' >> >> +test_expect_success 'create bare repo' ' >> + git clone --bare . bare >> +' > > I'd prefer to see separate clones for the two tests, so if one > catastrophically fails it does not affect the other. > >> + >> +test_expect_success 'test bisection on bare repo - --no-checkout specified' ' >> + test_when_finished "cd .." && >> + cd bare && >> + git bisect start --no-checkout && >> + git bisect good $HASH1 && >> + git bisect bad $HASH4 && >> + git bisect run sh -c \ >> + "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \ >> + >../my_bisect_log.txt && >> + grep "$HASH3 is the first bad commit" ../my_bisect_log.txt && >> + git bisect reset' > > I worry that "sh" might not actually be a POSIX shell on some systems. > Maybe a subshell could also simplify this. Like so:
Thanks. Am assuming Junio is ok with use of eval, given these reasons.
The subshell is a good idea. So...
+test_expect_success 'test bisection on bare repo - --no-checkout specified' ' + git clone --bare . bare.nocheckout && + ( + cd bare.nocheckout && + git bisect start --no-checkout && + git bisect good $HASH1 && + git bisect bad $HASH4 && + git bisect run eval \ + "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \ + >../nocheckout.log && + git bisect reset + ) && + grep "$HASH3 is the first bad commit" nocheckout.log +' + + +test_expect_success 'test bisection on bare repo - --no-checkout defaulted' ' + git clone --bare . bare.defaulted && + ( + cd bare.defaulted && + git bisect start && + git bisect good $HASH1 && + git bisect bad $HASH4 && + git bisect run eval \ + "test \$(git rev-list BISECT_HEAD ^$HASH2 --max-count=1 | wc -l) = 0" \ + >../defaulted.log && + git bisect reset + ) && + grep "$HASH3 is the first bad commit" defaulted.log +' +
jon.