aboutsummaryrefslogtreecommitdiff
path: root/git-rebase--interactive.sh
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2010-11-04 15:36:31 -0700
committerJunio C Hamano <gitster@pobox.com>2010-11-09 09:43:54 -0800
commitd3d7a421b1439a6f08dfbcd2e3327cbe90c93417 (patch)
tree15cde829d267f7d92b7005b13f8d80978219bfe1 /git-rebase--interactive.sh
parentaf77aee9cac51c2036e6019b4aebec2049f03e6b (diff)
downloadgit-d3d7a421b1439a6f08dfbcd2e3327cbe90c93417.tar.gz
git-d3d7a421b1439a6f08dfbcd2e3327cbe90c93417.tar.xz
rebase: better rearranging of fixup!/squash! lines with --autosquash
The current behvaior of --autosquash can duplicate fixup!/squash! lines if they match multiple commits, and it can also apply them to commits that come after them in the todo list. Even more oddly, a commit that looks like "fixup! fixup!" will match itself and be duplicated in the todo list. Change the todo list rearranging to mark all commits as used as soon as they are emitted, and to avoid emitting a fixup/squash commit if the commit has already been marked as used. Signed-off-by: Kevin Ballard <kevin@sb.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-rebase--interactive.sh')
-rwxr-xr-xgit-rebase--interactive.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index a27952d9f..379bbac5e 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -687,8 +687,12 @@ rearrange_squash () {
*" $sha1 "*) continue ;;
esac
printf '%s\n' "$pick $sha1 $message"
+ used="$used$sha1 "
while read -r squash action msg
do
+ case " $used" in
+ *" $squash "*) continue ;;
+ esac
case "$message" in
"$msg"*)
printf '%s\n' "$action $squash $action! $msg"