Thread (2 messages) flat view 2 messages, 2 authors, 2017-12-22

Re: [PATCH v2 2/2] commit: add support for --fixup <commit> -m"<extra message>"

From: Junio C Hamano <hidden>
Date: 2017-12-22 21:28:08

Ævar Arnfjörð Bjarmason  [off-list ref] writes:
Those options could also support combining with -m, but given what
they do I can't think of a good use-case for doing that, so I have not
made the more invasive change of splitting up the logic in commit.c to
first act on those, and then on -m options.

1. d71b8ba7c9 ("commit: --fixup option for use with rebase
   --autosquash", 2010-11-02)
To be fair, when "rebase --autosquash -i" is run (which is why you
would use --fixup in the first place), the log message of the fixup
one is used only for locating which one is to be corrected, and the
contents of the log message is discarded.  So "given what it does",
I can't think of a good use-case for using --fixup and -m together,
either.  So "nobody immediately thought of it when it was added" is
certainly not a reason to later make the combination possible.

But I personally am moderately negative on one of these two imagined
use cases.
Add support for supplying the -m option with --fixup. Doing so has
errored out ever since --fixup was introduced. Before this, the only
way to amend the fixup message while committing was to use --edit and
amend it in the editor.

The use-case for this feature is one of:

 * Leaving a quick note to self when creating a --fixup commit when
   it's not self-evident why the commit should be squashed without a
   note into another one.
This is probably OK.
 * (Ab)using the --fixup feature to "fix up" commits that have already
   been pushed to a branch that doesn't allow non-fast-forwards,
   i.e. just noting "this should have been part of that other commit",
   and if the history ever got rewritten in the future the two should
   be combined.
This has a smell of the tail wagging the dog.

Perhaps your editor does not have a good integration with external
commands to allow you to insert a single-liner output from

    git show --date=short -s --pretty='format:%h ("%s", %ad)' "$1"

and that is what you are abusing --fixup for?  

It is simply bad practice to leave a log entry that begins with
!fixup marker that would confuse automated tools like "rebase -i"
machinery on a commit that you have no intention of squashing into
another, as it invites mistakes.  

I do agree with the scenario where you would wish you could take
back an earlier mistake but you cannot.  But the log for such a
follow-up fix should be written just like any other follow-up fix
commit, i.e. describe what was wrong and how the wrongness is
corrected with the follow-up change.  What was wrong in "which
commit" is of course important part, but it is a relatively small
part.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help