On Wed, Oct 11, 2006 at 01:11:42AM -0700, Junio C Hamano wrote: > But I suspect that doing either of these things would harm > Cogito users. After cg-seek the user is not "in the middle of > another bisect", and if we run "git bisect --reset" when we see > head-name, it would probably break it too. Maybe expand head-name to include a "reason" field? Unfortunately we can't just stick it in the same file and remain compatible with all versions, so we'll have to use a new file. Something like: -- >8 -- git-bisect: use head-reason to explain use of head-name Since many different programs may use head-name to indicate that the working tree should not be modified, head-reason gives them a chance to explain what they're doing. This can improve the accuracy of error messages (such as won't bisect a seeked tree). Signed-off-by: Jeff King <peff@xxxxxxxx> --- Alternatively, the actual message to show the user could be placed in head-reason. I think it makes more sense as it is, as it provides the ability for the message to say "can't X because of Y" in plain English. And of course we need cogito to start supporting this (but we print something sane for older versions with don't support head-reason). git-bisect.sh | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/git-bisect.sh b/git-bisect.sh index 06a8d26..9f49dd3 100755 --- a/git-bisect.sh +++ b/git-bisect.sh @@ -57,8 +57,21 @@ bisect_start() { git checkout $branch || exit ;; refs/heads/*) - [ -s "$GIT_DIR/head-name" ] && die "won't bisect on seeked tree" + if [ -s "$GIT_DIR/head-name" ]; then + case "$(cat "$GIT_DIR/head-reason" 2>/dev/null)" in + bisect) + die "You are already in the middle of another bisect!" + ;; + seek) + die "You can't bisect a seeked tree!" + ;; + *) + die "head-name already exists" + ;; + esac + fi echo "$head" | sed 's#^refs/heads/##' >"$GIT_DIR/head-name" + echo bisect >"$GIT_DIR/head-reason" ;; *) die "Bad HEAD - strange symbolic ref" @@ -182,6 +195,7 @@ bisect_reset() { git checkout "$branch" && rm -fr "$GIT_DIR/refs/bisect" rm -f "$GIT_DIR/refs/heads/bisect" "$GIT_DIR/head-name" + rm -f "$GIT_DIR/head-reason" rm -f "$GIT_DIR/BISECT_LOG" rm -f "$GIT_DIR/BISECT_NAMES" } -- 1.4.2.3.g2c59-dirty > > - > 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 - 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