Re: [PATCH v2] config: add --comment option to add a comment
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 12, 2024, 07:44 UTC
- Message-ID
- <xmqqmsr3lwry.fsf@gitster.g>
- In-Reply-To
- <877ci7lxid.fsf@ra.horus-it.com>
Ralph Seichter <github@seichter.de> writes:
Show 9 quoted lines
> * Chris Torek: > >> You must use a literal line feed, e.g.: >> >> LF=' >> ' > > Of course, silly me. Easily done in a shell script. I was too focused on > trying it in an interactive shell. Thanks, Chris.
;-)
I think I've already given you that in my first message that mentioned multi-line input. In the test suite, we already have that $LF defined so your tests can use it without defining it yourself.
> Do you perhaps know of a function in the Git code base which could be > used to sanitise strings? It is quite a lot of code to sift through if > one is unfamiliar with it, so I'll gladly take hints.
Don't silently butcher end-user input; instead do something like this to make it clear that you do not support it.
if (strchr(comment_message, '\n'))
die(_("multi-line comment not supported: '%s'"),
comment_message);