]> git.ipfire.org Git - thirdparty/git.git/commitdiff
bisect: avoid tailing CR characters from revision in replay
authorCarlo Marcelo Arenas Belón <carenas@gmail.com>
Wed, 20 May 2020 17:08:43 +0000 (10:08 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 May 2020 17:13:19 +0000 (10:13 -0700)
6c722cbe5a (bisect: allow CRLF line endings in "git bisect replay"
input, 2020-05-07) includes CR as a field separator, but relies on
it not being included in the last field, which breaks at least when
running under OpenBSD 6.7's sh.

Instead of just assume the CR will get swallowed, read the rest of
the line into an otherwise unused variable and ignore it everywhere
except on the call for git bisect start, where it matters.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-bisect.sh

index 71b367a9447a6fb448e20fc606918103fc4f1bfc..08a6ed57ddb115413013ce5cd4c9a786b1a2bef9 100755 (executable)
@@ -210,7 +210,7 @@ bisect_replay () {
        test -r "$file" || die "$(eval_gettext "cannot read \$file for replaying")"
        git bisect--helper --bisect-reset || exit
        oIFS="$IFS" IFS="$IFS$(printf '\015')"
-       while read git bisect command rev
+       while read git bisect command rev tail
        do
                test "$git $bisect" = "git bisect" || test "$git" = "git-bisect" || continue
                if test "$git" = "git-bisect"
@@ -223,7 +223,7 @@ bisect_replay () {
                get_terms
                case "$command" in
                start)
-                       cmd="bisect_start $rev"
+                       cmd="bisect_start $rev $tail"
                        eval "$cmd" ;;
                "$TERM_GOOD"|"$TERM_BAD"|skip)
                        git bisect--helper --bisect-write "$command" "$rev" "$TERM_GOOD" "$TERM_BAD" || exit;;