[PATCH] bisect reset: Leave the tree in usable state if git-checkout failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I had local modifications in the tree and doing bisect reset required me to
manually edit .git/HEAD.

Signed-off-by: Petr Baudis <pasky@xxxxxxx>
---

 git-bisect.sh |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index 06a8d26..09cd179 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -179,11 +179,12 @@ bisect_reset() {
         *)
 	    usage ;;
 	esac
-	git checkout "$branch" &&
-	rm -fr "$GIT_DIR/refs/bisect"
-	rm -f "$GIT_DIR/refs/heads/bisect" "$GIT_DIR/head-name"
-	rm -f "$GIT_DIR/BISECT_LOG"
-	rm -f "$GIT_DIR/BISECT_NAMES"
+	if ! git checkout "$branch"; then
+		rm -fr "$GIT_DIR/refs/bisect"
+		rm -f "$GIT_DIR/refs/heads/bisect" "$GIT_DIR/head-name"
+		rm -f "$GIT_DIR/BISECT_LOG"
+		rm -f "$GIT_DIR/BISECT_NAMES"
+	fi
 }
 
 bisect_replay () {
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]