Matthieu Moy <[email protected]> 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)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html