bisect reset: Leave the tree in usable state if git-checkout failed
I had local modifications in the tree and doing bisect reset required me to manually edit .git/HEAD. Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
Petr Baudis committed
Oct 16, 2006 at 02:59 UTC
9b709e47ae46079efe1d7858580dcf5b8cf6ea33
1 file changed
+6
-5
git-bisect.sh
+6
-5
@@ -179,11 +179,12 @@ bisect_reset() {
179
*)
180
usage ;;
181
esac
182
- git checkout "$branch" &&
183
- rm -fr "$GIT_DIR/refs/bisect"
184
- rm -f "$GIT_DIR/refs/heads/bisect" "$GIT_DIR/head-name"
185
- rm -f "$GIT_DIR/BISECT_LOG"
186
- rm -f "$GIT_DIR/BISECT_NAMES"
182
+ if git checkout "$branch"; then
183
+ rm -fr "$GIT_DIR/refs/bisect"
184
+ rm -f "$GIT_DIR/refs/heads/bisect" "$GIT_DIR/head-name"
185
+ rm -f "$GIT_DIR/BISECT_LOG"
186
+ rm -f "$GIT_DIR/BISECT_NAMES"
187
+ fi
188
}
189
190
bisect_replay () {