Merge branch 'jc/rebase-i-commit-msg-fix'
* jc/rebase-i-commit-msg-fix: rebase-i: do not get fooled by a log message ending with backslash rebase-i: style fix
This commit is contained in:
commit
754e66b7a0
@ -263,10 +263,10 @@ pick_one_preserving_merges () {
|
|||||||
then
|
then
|
||||||
if test "$fast_forward" = t
|
if test "$fast_forward" = t
|
||||||
then
|
then
|
||||||
cat "$DOTEST"/current-commit | while read current_commit
|
while read current_commit
|
||||||
do
|
do
|
||||||
git rev-parse HEAD > "$REWRITTEN"/$current_commit
|
git rev-parse HEAD > "$REWRITTEN"/$current_commit
|
||||||
done
|
done <"$DOTEST"/current-commit
|
||||||
rm "$DOTEST"/current-commit ||
|
rm "$DOTEST"/current-commit ||
|
||||||
die "Cannot write current commit's replacement sha1"
|
die "Cannot write current commit's replacement sha1"
|
||||||
fi
|
fi
|
||||||
@ -440,9 +440,9 @@ record_in_rewritten() {
|
|||||||
echo "$oldsha1" >> "$REWRITTEN_PENDING"
|
echo "$oldsha1" >> "$REWRITTEN_PENDING"
|
||||||
|
|
||||||
case "$(peek_next_command)" in
|
case "$(peek_next_command)" in
|
||||||
squash|s|fixup|f)
|
squash|s|fixup|f)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
flush_rewritten_pending
|
flush_rewritten_pending
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -450,7 +450,7 @@ record_in_rewritten() {
|
|||||||
|
|
||||||
do_next () {
|
do_next () {
|
||||||
rm -f "$MSG" "$AUTHOR_SCRIPT" "$AMEND" || exit
|
rm -f "$MSG" "$AUTHOR_SCRIPT" "$AMEND" || exit
|
||||||
read command sha1 rest < "$TODO"
|
read -r command sha1 rest < "$TODO"
|
||||||
case "$command" in
|
case "$command" in
|
||||||
'#'*|''|noop)
|
'#'*|''|noop)
|
||||||
mark_action_done
|
mark_action_done
|
||||||
@ -591,7 +591,7 @@ do_rest () {
|
|||||||
# skip picking commits whose parents are unchanged
|
# skip picking commits whose parents are unchanged
|
||||||
skip_unnecessary_picks () {
|
skip_unnecessary_picks () {
|
||||||
fd=3
|
fd=3
|
||||||
while read command sha1 rest
|
while read -r command sha1 rest
|
||||||
do
|
do
|
||||||
# fd=3 means we skip the command
|
# fd=3 means we skip the command
|
||||||
case "$fd,$command,$(git rev-parse --verify --quiet $sha1^)" in
|
case "$fd,$command,$(git rev-parse --verify --quiet $sha1^)" in
|
||||||
@ -644,13 +644,13 @@ rearrange_squash () {
|
|||||||
test -s "$1.sq" || return
|
test -s "$1.sq" || return
|
||||||
|
|
||||||
used=
|
used=
|
||||||
while read pick sha1 message
|
while read -r pick sha1 message
|
||||||
do
|
do
|
||||||
case " $used" in
|
case " $used" in
|
||||||
*" $sha1 "*) continue ;;
|
*" $sha1 "*) continue ;;
|
||||||
esac
|
esac
|
||||||
echo "$pick $sha1 $message"
|
echo "$pick $sha1 $message"
|
||||||
while read squash action msg
|
while read -r squash action msg
|
||||||
do
|
do
|
||||||
case "$message" in
|
case "$message" in
|
||||||
"$msg"*)
|
"$msg"*)
|
||||||
@ -890,7 +890,8 @@ first and then run 'git rebase --continue' again."
|
|||||||
git rev-list $MERGES_OPTION --pretty=oneline --abbrev-commit \
|
git rev-list $MERGES_OPTION --pretty=oneline --abbrev-commit \
|
||||||
--abbrev=7 --reverse --left-right --topo-order \
|
--abbrev=7 --reverse --left-right --topo-order \
|
||||||
$REVISIONS | \
|
$REVISIONS | \
|
||||||
sed -n "s/^>//p" | while read shortsha1 rest
|
sed -n "s/^>//p" |
|
||||||
|
while read -r shortsha1 rest
|
||||||
do
|
do
|
||||||
if test t != "$PRESERVE_MERGES"
|
if test t != "$PRESERVE_MERGES"
|
||||||
then
|
then
|
||||||
|
@ -630,4 +630,22 @@ test_expect_success 'always cherry-pick with --no-ff' '
|
|||||||
test_cmp empty out
|
test_cmp empty out
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'set up commits with funny messages' '
|
||||||
|
git checkout -b funny A &&
|
||||||
|
echo >>file1 &&
|
||||||
|
test_tick &&
|
||||||
|
git commit -a -m "end with slash\\" &&
|
||||||
|
echo >>file1 &&
|
||||||
|
test_tick &&
|
||||||
|
git commit -a -m "another commit"
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'rebase-i history with funny messages' '
|
||||||
|
git rev-list A..funny >expect &&
|
||||||
|
test_tick &&
|
||||||
|
FAKE_LINES="1 2" git rebase -i A &&
|
||||||
|
git rev-list A.. >actual &&
|
||||||
|
test_cmp expect actual
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user