diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-07-01 12:41:52 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-07-01 12:41:52 -0700 |
commit | eb3a4fc149d1a0d604ea6abf9085b3acfe3e85e6 (patch) | |
tree | c2cea01d268485d0054dc11e00869e4cc4ce898a /git-rebase--interactive.sh | |
parent | Merge branch 'kb/am-deprecate-resolved' (diff) | |
parent | lib-rebase: style: use write_script, <<-\EOF (diff) | |
download | tgif-eb3a4fc149d1a0d604ea6abf9085b3acfe3e85e6.tar.xz |
Merge branch 'ap/rebase-multiple-fixups'
Having multiple "fixup!" on a line in the rebase instruction sheet
did not work very well with "git rebase -i --autosquash".
* ap/rebase-multiple-fixups:
lib-rebase: style: use write_script, <<-\EOF
rebase -i: handle fixup! fixup! in --autosquash
Diffstat (limited to 'git-rebase--interactive.sh')
-rw-r--r-- | git-rebase--interactive.sh | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index f953d8d224..169e876eed 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -689,8 +689,22 @@ rearrange_squash () { case "$message" in "squash! "*|"fixup! "*) action="${message%%!*}" - rest="${message#*! }" - echo "$sha1 $action $rest" + rest=$message + prefix= + # skip all squash! or fixup! (but save for later) + while : + do + case "$rest" in + "squash! "*|"fixup! "*) + prefix="$prefix${rest%%!*}," + rest="${rest#*! }" + ;; + *) + break + ;; + esac + done + echo "$sha1 $action $prefix $rest" # if it's a single word, try to resolve to a full sha1 and # emit a second copy. This allows us to match on both message # and on sha1 prefix @@ -699,7 +713,7 @@ rearrange_squash () { if test -n "$fullsha"; then # prefix the action to uniquely identify this line as # intended for full sha1 match - echo "$sha1 +$action $fullsha" + echo "$sha1 +$action $prefix $fullsha" fi fi esac @@ -714,7 +728,7 @@ rearrange_squash () { esac printf '%s\n' "$pick $sha1 $message" used="$used$sha1 " - while read -r squash action msg_content + while read -r squash action msg_prefix msg_content do case " $used" in *" $squash "*) continue ;; @@ -730,7 +744,8 @@ rearrange_squash () { case "$message" in "$msg_content"*) emit=1;; esac ;; esac if test $emit = 1; then - printf '%s\n' "$action $squash $action! $msg_content" + real_prefix=$(echo "$msg_prefix" | sed "s/,/! /g") + printf '%s\n' "$action $squash ${real_prefix}$msg_content" used="$used$squash " fi done <"$1.sq" |