Subject: Re: Log messages beginning # and git rebase -i

From: Matthieu Moy <[email-masked]>
Date: Wed, 29 Jul 2015 18:03:47 +0200

Junio C Hamano <[email-masked]> writes:

> Matthieu Moy <[email-masked]> writes:
>
>> Duy Nguyen <[email-masked]> writes:
>>
>>> On Wed, Jul 29, 2015 at 12:48 AM, Matthieu Moy
>>> <[email-masked]> wrote:
>>>>> If the user wants whatever she types in the resulting commit
>>>>> literally, there is the "--cleanup=<choice>" option, no?
>>>>
>>>> $ GIT_EDITOR=touch git commit --cleanup=verbatim
>>>> [detached HEAD 1b136a7] # Please enter the commit message for your
>>>> changes. Lines starting # with '#' will be kept; you may remove
>>>> them yourself if you want
>>>> to. # An empty message aborts the commit. # HEAD detached from
>>>> 5e70007 # Changes to be committed: # modified: foo.txt # # Changes
>>>> not staged for commit
>>>> : #     modified:   foo.txt # # Untracked files: #      last-synchro.txt #
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> You really don't want that in day-to-day use.
>
> I do not quite follow this example.
>
> The user said "I'll be responsible for cleaning up" by giving the
> option.  It is up to the user to use an editor that is something a
> bit more intelligent than "touch" to remove the instructional
> comments meant for humans after reading them.

Yes, --cleanup=verbatim does what it says it does. Now, my claim is that
it does not answer the use-case "I want an easy way to talk about # in a
commit message". First, you have to specify --cleanup=verbatim _before_
typing the message, hence before knowing that you may need a #.

Then, as you say, it is up to the user to remove things that Git has
added. Why would we ask the user to do this when we have a way to have
the tool do it?

>> 2) Modify Git to add scissors by default, and use --cleanup=scissors by
>>    default.
>
> I just did "$ git commit --amend --cleanup=scissors" (with and
> without --amend) and it seems to do exactly that ;-).

Ah, I did my test in the same repo I messed-up with --cleanup=verbatim.
It's better than I thought then. So a viable alternative to the
backslas-escaping would be to change commit.cleanup to scissors by
default.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/