Re: [PATCH v5 4/5] fast-export: differentiate between explicitly utf-8 and implicitly utf-8
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- May 14, 2019, 03:01 UTC
- Message-ID
- <20190514030123.atqguzxh4v55ydty@tb-raspi4>
- In-Reply-To
- <20190513231726.16218-5-newren@gmail.com>
On Mon, May 13, 2019 at 04:17:25PM -0700, Elijah Newren wrote:
> The find_encoding() function returned the encoding used by a commit > message, returning a default of git_commit_encoding (usually utf-8).
I think "UTF-8" is preferred over "utf-8". Unless it is a function name like is_encoding_utf8()
Show 28 quoted lines
> Although the current code does not differentiate between a commit which > explicitly requested utf-8 and one where we just assume utf-8 because no > encoding is set, it will become important when we try to preserve the > encoding header. Since is_encoding_utf8() returns true when passed > NULL, we can just return NULL from find_encoding() instead of returning > git_commit_encoding. > > Signed-off-by: Elijah Newren <newren@gmail.com> > --- > builtin/fast-export.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/builtin/fast-export.c b/builtin/fast-export.c > index 7734a9f5a5..66331fa401 100644 > --- a/builtin/fast-export.c > +++ b/builtin/fast-export.c > @@ -453,7 +453,7 @@ static const char *find_encoding(const char *begin, const char *end) > bol = memmem(begin, end ? end - begin : strlen(begin), > needle, strlen(needle)); > if (!bol) > - return git_commit_encoding; > + return NULL; > bol += strlen(needle); > eol = strchrnul(bol, '\n'); > *eol = '\0'; > -- > 2.21.0.782.gd8be4ee826 >