Subject: Re: [PATCH v11 06/10] bisect: don't mix option parsing and non-trivial code

From: Junio C Hamano <[email-masked]>
Date: Mon, 29 Jun 2015 13:28:36 -0700

Matthieu, are you allowing your editor to corrupt the number of
lines in the hunk on the @@ ... @@ hunk header?  "diff" mode in
Emacs does that, and there may be other editors that has the same
bug, but please be careful---they make the patch unapplicable.

Count the preimage lines in the hunk below.  I count 24 but somebody
is lying there.

> @@ -102,25 +103,27 @@ bisect_start() {
>  				die "$(eval_gettext "'\$arg' does not appear to be a valid revision")"
>  				break
>  			}
> -
> -			# The user ran "git bisect start <sha1>
> -			# <sha1>", hence did not explicitly specify
> -			# the terms, but we are already starting to
> -			# set references named with the default terms,
> -			# and won't be able to change afterwards.
> -			must_write_terms=1
> -
> -			case $bad_seen in
> -			0) state=$TERM_BAD ; bad_seen=1 ;;
> -			*) state=$TERM_GOOD ;;
> -			esac
> -			eval="$eval bisect_write '$state' '$rev' 'nolog' &&"
> +			revs="$revs $rev"
>  			shift
>  			;;
>  		esac
>  	done
>  
> +	for rev in $revs
> +	do
> +		# The user ran "git bisect start <sha1>
> +		# <sha1>", hence did not explicitly specify
> +		# the terms, but we are already starting to
> +		# set references named with the default terms,
> +		# and won't be able to change afterwards.
> +		must_write_terms=1
> +
> +		case $bad_seen in
> +		0) state=$TERM_BAD ; bad_seen=1 ;;
> +		*) state=$TERM_GOOD ;;
> +		esac
> +		eval="$eval bisect_write '$state' '$rev' 'nolog' &&"
> +	done
>  	#
>  	# Verify HEAD.
>  	#
> -- 
> 2.5.0.rc0.10.gd2bff5d