From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Ed Avis <eda@waniasset.com>, git@vger.kernel.org
Subject: Re: Log messages beginning # and git rebase -i
Date: Tue, 28 Jul 2015 11:44:15 -0700 [thread overview]
Message-ID: <xmqqtwsodsw0.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <vpq3808p40o.fsf@anie.imag.fr> (Matthieu Moy's message of "Tue, 28 Jul 2015 19:48:23 +0200")
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
> 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.
> ...
> backslash-escaping special characters seems very natural to me,...
OK. So the proposal on the table is that a backslash at the
beginning of a line is stripped.
Stripping part should look like this. To make it work for things
like "git commit --amend", you would need to prefix any line that
comes from the payload that begins with the core.commentchar or a
backslash with a backslash.
diff --git a/builtin/stripspace.c b/builtin/stripspace.c
index 1259ed7..39ecb92 100644
--- a/builtin/stripspace.c
+++ b/builtin/stripspace.c
@@ -52,6 +52,11 @@ void stripspace(struct strbuf *sb, int skip_comments)
}
newlen = cleanup(sb->buf + i, len);
+ if (newlen && sb->buf[i] == '\\') {
+ i++;
+ newlen--;
+ }
+
/* Not just an empty line? */
if (newlen) {
if (empties > 0 && j > 0)
next prev parent reply other threads:[~2015-07-28 18:44 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
2015-07-28 18:44 ` Junio C Hamano [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqtwsodsw0.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=eda@waniasset.com \
--cc=git@vger.kernel.org \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).