From: Junio C Hamano Date: Wed, 14 Dec 2011 18:19:16 GMT Subject: Re: [PATCH 3/3] Do not create commits whose message contains NUL Message-ID: <7vzkevow2j.fsf@alter.siamese.dyndns.org> In-Reply-To: <1323871699-8839-4-git-send-email-pclouds@gmail.com> Nguyễn Thái Ngọc Duy writes: > We assume that the commit log messages are uninterpreted sequences of > non-NUL bytes (see Documentation/i18n.txt). However the assumption > does not really stand out and it's quite easy to set an editor to save > in a NUL-included encoding. Currently we silently cut at the first NUL > we see. > > Make it more obvious that NUL is not welcome by refusing to create > such commits. Those who deliberately want to create them can still do > with hash-object. > > Signed-off-by: Nguyễn Thái Ngọc Duy Limiting the Porcelain layer to deal only with reasonable text encodings (yes, I am declaring that utf16 is not among them) is perfectly fine, but I was somehow hoping that you would allow the option for the low-level function commit_tree() to create a commit object with binary blob in the body part, especially after seeing the patch 1/3 to do so. Certainly that kind of usage would not give the binary blob literally in "git log" output, but it is with or without the issue around NUL byte. A custom program linked with commit.c to call commit_tree() may not be using the data structure to store anything that is meant to be read by "git log" to begin with. Not a strong veto at all, just throwing out something to think about.