Andrew Pimlott [off-list ref] writes:
git rebase -i --autosquash does not handle a fixup! of a fixup!, such as
the history:
aaaaaaa fix nasty bug
...
bbbbbbb fixup! fix nasty bug
...
ccccccc fixup! fixup! fix nasty bug
--autosquash produces:
pick aaaaaaa fix nasty bug
fixup bbbbbbb fixup! fix nasty bug
...
pick ccccccc fixup! fixup! fix nasty bug
This defeats the workflow I was hoping to use:
git commit -m 'fix nasty bug'
...
git commit --fixup :/nasty
...
git commit --fixup :/nasty
The second :/nasty resolves to the previous fixup, not the initial
commit. I could have made the regular expression more precise, but this
would be a hassle.
Would a change to support fixup! fixup! be considered?
Sure, why not. You could start with something like the patch below
(untested). If that happens to work, just add a test and a good commit
message.
diff --git i/git-rebase--interactive.sh w/git-rebase--interactive.sh
index f953d8d..798ae81 100644
--- i/git-rebase--interactive.sh
+++ w/git-rebase--interactive.sh
@@ -689,7 +689,17 @@ rearrange_squash () {
case "$message" in
"squash! "*|"fixup! "*)
action="${message%%!*}"
- rest="${message#*! }"
+ rest=$message
+ while : ; do
+ case "$rest" in
+ "squash! "*|"fixup! "*)
+ rest="${rest#*! }"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
echo "$sha1 $action $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
--
Thomas Rast
trast@{inf,student}.ethz.ch