Skip to content

Commit f9dbe28

Browse files
committed
Merge branch 'cw/bisect-replay-with-dos'
"git bisect replay" had trouble with input files when they used CRLF line ending, which has been corrected. * cw/bisect-replay-with-dos: bisect: allow CRLF line endings in "git bisect replay" input
2 parents 3583730 + 6c722cb commit f9dbe28

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

git-bisect.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ bisect_replay () {
209209
test "$#" -eq 1 || die "$(gettext "No logfile given")"
210210
test -r "$file" || die "$(eval_gettext "cannot read \$file for replaying")"
211211
git bisect--helper --bisect-reset || exit
212+
oIFS="$IFS" IFS="$IFS$(printf '\015')"
212213
while read git bisect command rev
213214
do
214215
test "$git $bisect" = "git bisect" || test "$git" = "git-bisect" || continue
@@ -232,6 +233,7 @@ bisect_replay () {
232233
die "$(gettext "?? what are you talking about?")" ;;
233234
esac
234235
done <"$file"
236+
IFS="$oIFS"
235237
bisect_auto_next
236238
}
237239

t/t6030-bisect-porcelain.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,13 @@ test_expect_success 'bisect replay with old and new' '
792792
git bisect reset
793793
'
794794

795+
test_expect_success 'bisect replay with CRLF log' '
796+
append_cr <log_to_replay.txt >log_to_replay_crlf.txt &&
797+
git bisect replay log_to_replay_crlf.txt >bisect_result_crlf &&
798+
grep "$HASH2 is the first new commit" bisect_result_crlf &&
799+
git bisect reset
800+
'
801+
795802
test_expect_success 'bisect cannot mix old/new and good/bad' '
796803
git bisect start &&
797804
git bisect bad $HASH4 &&

0 commit comments

Comments
 (0)