David Turner <[email protected]> writes:

> Instead of directly writing to and reading from files in
> $GIT_DIR, use ref API to interact with BISECT_HEAD.
>
> Signed-off-by: David Turner <[email protected]>
> ---

Interesting.  From the patch, it seems that the codepath that writes
BISECT_HEAD were already doing update-ref instead of writing into or
removing a file.

The result of applying this patch looked sane.  Thanks.

>  git-bisect.sh | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/git-bisect.sh b/git-bisect.sh
> index ae3fec2..dddcc89 100755
> --- a/git-bisect.sh
> +++ b/git-bisect.sh
> @@ -35,7 +35,7 @@ _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
>  
>  bisect_head()
>  {
> -     if test -f "$GIT_DIR/BISECT_HEAD"
> +     if bisect_head_exists
>       then
>               echo BISECT_HEAD
>       else
> @@ -209,6 +209,10 @@ check_expected_revs() {
>       done
>  }
>  
> +bisect_head_exists() {
> +    git rev-parse --quiet --verify "BISECT_HEAD" >/dev/null
> +}
> +
>  bisect_skip() {
>       all=''
>       for arg in "$@"
> @@ -310,7 +314,7 @@ bisect_next() {
>       bisect_next_check good
>  
>       # Perform all bisection computation, display and checkout
> -     git bisect--helper --next-all $(test -f "$GIT_DIR/BISECT_HEAD" && echo 
> --no-checkout)
> +     git bisect--helper --next-all $(bisect_head_exists && echo 
> --no-checkout)
>       res=$?
>  
>       # Check if we should exit because bisection is finished
> @@ -377,7 +381,7 @@ bisect_reset() {
>               usage ;;
>       esac
>  
> -     if ! test -f "$GIT_DIR/BISECT_HEAD" && ! git checkout "$branch" --
> +     if ! bisect_head_exists && ! git checkout "$branch" --
>       then
>               die "$(eval_gettext "Could not check out original HEAD 
> '\$branch'.
>  Try 'git bisect reset <commit>'.")"
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to