mirror of
https://github.com/git/git.git
synced 2025-01-26 09:24:14 +08:00
Bisect reset: do nothing when not bisecting.
Before this patch, using "git bisect reset" when not bisecting did a "git checkout master" for no good reason. This also happened using "git bisect replay" when not bisecting because "bisect_replay" starts by calling "bisect_reset". Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
6459c7c678
commit
fce0499fad
@ -328,6 +328,10 @@ bisect_visualize() {
|
||||
}
|
||||
|
||||
bisect_reset() {
|
||||
test -f "$GIT_DIR/BISECT_NAMES" || {
|
||||
echo "We are not bisecting."
|
||||
return
|
||||
}
|
||||
case "$#" in
|
||||
0) if [ -s "$GIT_DIR/head-name" ]; then
|
||||
branch=`cat "$GIT_DIR/head-name"`
|
||||
|
@ -71,6 +71,31 @@ test_expect_success 'bisect start with one bad and good' '
|
||||
git bisect next
|
||||
'
|
||||
|
||||
test_expect_success 'bisect reset: back in the master branch' '
|
||||
git bisect reset &&
|
||||
echo "* master" > branch.expect &&
|
||||
git branch > branch.output &&
|
||||
cmp branch.expect branch.output
|
||||
'
|
||||
|
||||
test_expect_success 'bisect reset: back in another branch' '
|
||||
git checkout -b other &&
|
||||
git bisect start &&
|
||||
git bisect good $HASH1 &&
|
||||
git bisect bad $HASH3 &&
|
||||
git bisect reset &&
|
||||
echo " master" > branch.expect &&
|
||||
echo "* other" >> branch.expect &&
|
||||
git branch > branch.output &&
|
||||
cmp branch.expect branch.output
|
||||
'
|
||||
|
||||
test_expect_success 'bisect reset when not bisecting' '
|
||||
git bisect reset &&
|
||||
git branch > branch.output &&
|
||||
cmp branch.expect branch.output
|
||||
'
|
||||
|
||||
test_expect_success 'bisect reset removes packed refs' '
|
||||
git bisect reset &&
|
||||
git bisect start &&
|
||||
@ -179,7 +204,7 @@ test_expect_success 'bisect skip: add line and then a new test' '
|
||||
git bisect skip &&
|
||||
git bisect good > my_bisect_log.txt &&
|
||||
grep "$HASH5 is first bad commit" my_bisect_log.txt &&
|
||||
git bisect log > log_to_replay.txt
|
||||
git bisect log > log_to_replay.txt &&
|
||||
git bisect reset
|
||||
'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user