Skip to content

Commit 10793e6

Browse files
committed
Merge branch 'sg/bisect'
* sg/bisect: bisect: check for mandatory argument of 'bisect replay' bisect: improve error msg of 'bisect reset' when original HEAD is deleted bisect: improve error message of 'bisect log' while not bisecting
2 parents 734e0ba + 2c7c387 commit 10793e6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

git-bisect.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,12 @@ bisect_reset() {
316316
*)
317317
usage ;;
318318
esac
319-
git checkout "$branch" -- && bisect_clean_state
319+
if git checkout "$branch" -- ; then
320+
bisect_clean_state
321+
else
322+
die "Could not check out original HEAD '$branch'." \
323+
"Try 'git bisect reset <commit>'."
324+
fi
320325
}
321326

322327
bisect_clean_state() {
@@ -338,6 +343,7 @@ bisect_clean_state() {
338343
}
339344

340345
bisect_replay () {
346+
test "$#" -eq 1 || die "No logfile given"
341347
test -r "$1" || die "cannot read $1 for replaying"
342348
bisect_reset
343349
while read git bisect command rev
@@ -412,6 +418,10 @@ bisect_run () {
412418
done
413419
}
414420

421+
bisect_log () {
422+
test -s "$GIT_DIR/BISECT_LOG" || die "We are not bisecting."
423+
cat "$GIT_DIR/BISECT_LOG"
424+
}
415425

416426
case "$#" in
417427
0)
@@ -438,7 +448,7 @@ case "$#" in
438448
replay)
439449
bisect_replay "$@" ;;
440450
log)
441-
cat "$GIT_DIR/BISECT_LOG" ;;
451+
bisect_log ;;
442452
run)
443453
bisect_run "$@" ;;
444454
*)

0 commit comments

Comments
 (0)