@matheusbsbs / matheus-bagliano / commits / 173cb08d5b
Fork 0

bisect: avoid tailing CR characters from revision in replay

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>

Carlo Marcelo Arenas Belón committed May 20, 2020 at 10:08 UTC 173cb08d5b38f423b3cae409daa6d414348c3459
1 file changed +2 -2
git-bisect.sh
+2 -2
@@ -210,7 +210,7 @@ bisect_replay () {
210 test -r "$file" || die "$(eval_gettext "cannot read \$file for replaying")"
211 git bisect--helper --bisect-reset || exit
212 oIFS="$IFS" IFS="$IFS$(printf '\015')"
213 - while read git bisect command rev
213 + while read git bisect command rev tail
214 do
215 test "$git $bisect" = "git bisect" || test "$git" = "git-bisect" || continue
216 if test "$git" = "git-bisect"
@@ -223,7 +223,7 @@ bisect_replay () {
223 get_terms
224 case "$command" in
225 start)
226 - cmd="bisect_start $rev"
226 + cmd="bisect_start $rev $tail"
227 eval "$cmd" ;;
228 "$TERM_GOOD"|"$TERM_BAD"|skip)
229 git bisect--helper --bisect-write "$command" "$rev" "$TERM_GOOD" "$TERM_BAD" || exit;;