Re: [PATCH 0/3] Add a "fix" command to "rebase --interactive"
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 8, 2009, 09:24 UTC
- Message-ID
- <7viqchhl7h.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <20091208121314.6117@nanako3.lavabit.com>
Nanako Shiraishi <nanako3@lavabit.com> writes:
Show 27 quoted lines
> @@ -519,6 +521,43 @@ get_saved_options () {
> test -f "$DOTEST"/rebase-root && REBASE_ROOT=t
> }
>
> +# Rearrange the todo list that has both "pick sha1 msg" and
> +# "pick sha1 !fixup/!squash msg" appears in it so that the latter
> +# comes immediately after the former, and change "pick" to
> +# "fixup"/"squash".
> +rearrange_squash () {
> + sed -n -e 's/^pick \([0-9a-f]*\) !\(squash\) /\1 \2 /p' \
> + -e 's/^pick \([0-9a-f]*\) !\(fixup\) /\1 \2 /p' \
> + "$1" >"$1.sq"
> + test -s "$1.sq" || return
> +
> + sed -e '/^pick [0-9a-f]* !squash /d' \
> + -e '/^pick [0-9a-f]* !fixup /d' \
> + "$1" |
> + (
> + used=
> + while read pick sha1 message
> + do
> + ...
> + done >"$1.rearranged"
> + )
> + cat "$1.rearranged" >"$1"
> + rm -f "$1.sq"
> +}The logic to move the lines seem to have been improved since the last round, which is good. I've amended this to remove "$1.rearranged" as well.
Unlike the very initial round, but like the second round, this feature is controlled by an explicit command line option, so it should be reasonably safe.
I hate bikeshedding but somehow
git commit -m "fixup! commit with this message"
feels much more natural than having to write
git commit -m "!fixup commit with this message".