fast-export: differentiate between explicitly UTF-8 and implicitly UTF-8
The find_encoding() function returned the encoding used by a commit message, returning a default of git_commit_encoding (usually UTF-8). 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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elijah Newren committed
May 13, 2019 at 21:31 UTC
57a8be2cb0cb6825d25885b34106aab79d6c9853
1 file changed
+1
-1
builtin/fast-export.c
+1
-1
@@ -453,7 +453,7 @@ static const char *find_encoding(const char *begin, const char *end)
453
bol = memmem(begin, end ? end - begin : strlen(begin),
454
needle, strlen(needle));
455
if (!bol)
456
- return git_commit_encoding;
456
+ return NULL;
457
bol += strlen(needle);
458
eol = strchrnul(bol, '\n');
459
*eol = '\0';