If one has the following commits 5154127 fixup! fixup! one 0d130d8 fixup! one 0869d30 one current code will only rearrange 0d130d8 because it thinks it has already checked for commits that modify it. Separate the idea of an 'used' and an 'applied' line. Applied lines are the ones that have been moved to modify some commit whilst used lines are the ones for which we have tried to find modifications. --- This supports the case I originally mentioned. It however breaks quite badly if one has two chains, such as 0792561 fixup! squash! squash! six e72100f squash! squash! six 90187b8 fixup! fixup! one 6facd7d fixup! one 4f48f55 one 733844b squash! six e9de3cc six 76990c9 five db0d525 one because it will try to add 0792561 as a fixup to e72100f. However, as it has moved, it is made into a fixup of 90187b8, which is definitely bad (not that I think anybody would ever have such a chain in real life). This should be fixable by modifying the loop a bit so it doesn't read the next line on each iteration so we can feed it the current line. Would you be interested in such a patch? For me this is a bit more elegant than removing the "fixup!" on commit (though my shell skills aren't that great). git-rebase--interactive.sh | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 5873ba4..a681f47 100755 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -692,16 +692,22 @@ rearrange_squash () { test -s "$1.sq" || return used= + applied= while read -r pick sha1 message do case " $used" in *" $sha1 "*) continue ;; esac - printf '%s\n' "$pick $sha1 $message" + # If it's been applied, we don't want to output the "pick" line + case " $applied" in + *" $sha1 "*) ;; + *) printf '%s\n' "$pick $sha1 $message";; + esac used="$used$sha1 " while read -r squash action msg do - case " $used" in + # Ignore the commits we've already dealt with + case " $used $applied " in *" $squash "*) continue ;; esac emit=0 @@ -716,7 +722,7 @@ rearrange_squash () { esac if test $emit = 1; then printf '%s\n' "$action $squash $action! $msg" - used="$used$squash " + applied="$applied$squash " fi done <"$1.sq" done >"$1.rearranged" <"$1" -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html