rebase-i: do not get fooled by a log message ending with backslash
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jul 5, 2010 at 23:08 UTC
57f2b6b25868e32a25181b2a345b5bab3e3ba78f
2 files changed
+23
-5
git-rebase--interactive.sh
+5
-5
@@ -450,7 +450,7 @@ record_in_rewritten() {
450
451
do_next () {
452
rm -f "$MSG" "$AUTHOR_SCRIPT" "$AMEND" || exit
453
- read command sha1 rest < "$TODO"
453
+ read -r command sha1 rest < "$TODO"
454
case "$command" in
455
'#'*|''|noop)
456
mark_action_done
@@ -591,7 +591,7 @@ do_rest () {
591
# skip picking commits whose parents are unchanged
592
skip_unnecessary_picks () {
593
fd=3
594
- while read command sha1 rest
594
+ while read -r command sha1 rest
595
do
596
# fd=3 means we skip the command
597
case "$fd,$command,$(git rev-parse --verify --quiet $sha1^)" in
@@ -644,13 +644,13 @@ rearrange_squash () {
644
test -s "$1.sq" || return
645
646
used=
647
- while read pick sha1 message
647
+ while read -r pick sha1 message
648
do
649
case " $used" in
650
*" $sha1 "*) continue ;;
651
esac
652
echo "$pick $sha1 $message"
653
- while read squash action msg
653
+ while read -r squash action msg
654
do
655
case "$message" in
656
"$msg"*)
@@ -891,7 +891,7 @@ first and then run 'git rebase --continue' again."
891
--abbrev=7 --reverse --left-right --topo-order \
892
$REVISIONS | \
893
sed -n "s/^>//p" |
894
- while read shortsha1 rest
894
+ while read -r shortsha1 rest
895
do
896
if test t != "$PRESERVE_MERGES"
897
then
t/t3404-rebase-interactive.sh
+18
@@ -630,4 +630,22 @@ test_expect_success 'always cherry-pick with --no-ff' '
630
test_cmp empty out
631
'
632
633
+test_expect_success 'set up commits with funny messages' '
634
+ git checkout -b funny A &&
635
+ echo >>file1 &&
636
+ test_tick &&
637
+ git commit -a -m "end with slash\\" &&
638
+ echo >>file1 &&
639
+ test_tick &&
640
+ git commit -a -m "another commit"
641
+'
642
+
643
+test_expect_success 'rebase-i history with funny messages' '
644
+ git rev-list A..funny >expect &&
645
+ test_tick &&
646
+ FAKE_LINES="1 2" git rebase -i A &&
647
+ git rev-list A.. >actual &&
648
+ test_cmp expect actual
649
+'
650
+
651
test_done