Skip to content

Commit 6bc02d5

Browse files
chriscoolgitster
authored andcommitted
bisect: parse revs before passing them to check_expected_revs()
When running for example "git bisect bad HEAD" or "git bisect good master", the parameter passed to "git bisect (bad|good)" has to be parsed into a commit hash before checking if it is the expected commit or not. We could do that in is_expected_rev() or in check_expected_revs(), but it is already done in bisect_state(). Let's just store the hash values that result from this parsing, and then reuse them after all the parsing is done. This way we can also use a for loop over these values to call bisect_write() on them, instead of using eval. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c2e8e4b commit 6bc02d5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

git-bisect.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,18 @@ bisect_state() {
237237
check_expected_revs "$rev" ;;
238238
2,bad|*,good|*,skip)
239239
shift
240-
eval=''
240+
hash_list=''
241241
for rev in "$@"
242242
do
243243
sha=$(git rev-parse --verify "$rev^{commit}") ||
244244
die "$(eval_gettext "Bad rev input: \$rev")"
245-
eval="$eval bisect_write '$state' '$sha'; "
245+
hash_list="$hash_list $sha"
246246
done
247-
eval "$eval"
248-
check_expected_revs "$@" ;;
247+
for rev in $hash_list
248+
do
249+
bisect_write "$state" "$rev"
250+
done
251+
check_expected_revs $hash_list ;;
249252
*,bad)
250253
die "$(gettext "'git bisect bad' can take only one argument.")" ;;
251254
*)

0 commit comments

Comments
 (0)