From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Junio C Hamano <gitster@pobox.com>
Cc: Ed Avis <eda@waniasset.com>, git@vger.kernel.org
Subject: Re: Log messages beginning # and git rebase -i
Date: Tue, 28 Jul 2015 19:48:23 +0200 [thread overview]
Message-ID: <vpq3808p40o.fsf@anie.imag.fr> (raw)
In-Reply-To: <xmqqr3nsfdmw.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Tue, 28 Jul 2015 09:30:47 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
>
>> Actually, is there any reason why we do not allow a simple escaping like
>>
>> \# this is a line starting with #
>> \\ this is a line starting with \
>> # this is a comment
>
> What are we trying to achieve?
What I would like would be a simple way to:
1) Allow any commit message to be typed. If I want to talk about #include
in my commit message, I should have an easy way to do so.
2) Allow commands that pop an editor on an existing message to preserve
the original message, whatever it is. Well, actually Git even strips
# lines even if it doesn't pop the editor.
Currently, I can for example:
$ git commit -m "#include" -a
[detached HEAD 0f36ec9] #include
1 file changed, 1 insertion(+), 1 deletion(-)
$ GIT_EDITOR=touch git commit --amend
Aborting commit due to empty commit message.
A simple escaping scheme like the above can solve both points:
1) If I want to talk about #include in my commit message, I can spell it
\#include and Git would remove the \. The same way, if I want to tell
my shell about a " inside a string, I can write "double-quote:\"."
and get a litteral double-quote.
2) A command that pops an editor could add the escaping where needed,
pop the editor, and then unescape. A command like "pick" in "rebase
-i" could escape the message, and feed it to "git commit" which would
unescape it.
> Munging the original "# I want this line intact" to any other form
> like " # I want this..." is as bad as losing it.
It would modify it only when shown in the text editor. The object
database would contain unescaped message, hence "git log" would show it
unescaped for example.
backslash-escaping special characters seems very natural to me, and I
guess it would be for most computer-scientists. If I have problem with a
special character, the first thing I would try would be to add a
backslash in front of it.
> 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.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
next prev parent reply other threads:[~2015-07-28 17:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-27 11:38 Log messages beginning # and git rebase -i Ed Avis
2015-07-27 23:25 ` Eric Sunshine
2015-07-28 0:53 ` Duy Nguyen
2015-07-28 9:51 ` Ed Avis
2015-07-28 15:25 ` Matthieu Moy
2015-07-28 16:30 ` Junio C Hamano
2015-07-28 16:40 ` Ed Avis
2015-07-28 17:48 ` Matthieu Moy [this message]
2015-07-28 18:44 ` Junio C Hamano
2015-07-29 10:17 ` Matthieu Moy
2015-07-29 10:19 ` Ed Avis
2019-04-22 10:05 ` [PATCH] allow commentChars in commit messages Corentin BOMPARD
2015-07-29 10:47 ` Log messages beginning # and git rebase -i Duy Nguyen
2015-07-29 12:17 ` Matthieu Moy
2015-07-29 12:47 ` Duy Nguyen
2015-07-29 15:54 ` Junio C Hamano
2015-07-29 16:03 ` Matthieu Moy
2015-07-29 17:02 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vpq3808p40o.fsf@anie.imag.fr \
--to=matthieu.moy@grenoble-inp.fr \
--cc=eda@waniasset.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.