summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2019-05-14 04:31:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-14 07:48:56 (GMT)
commit57a8be2cb0cb6825d25885b34106aab79d6c9853 (patch)
treec346cef4f9ab713bfad8e2c04886355205cf7bde /builtin
parentccbfc96dc480a1395f2068c706f53fe0881c8356 (diff)
downloadgit-57a8be2cb0cb6825d25885b34106aab79d6c9853.zip
git-57a8be2cb0cb6825d25885b34106aab79d6c9853.tar.gz
git-57a8be2cb0cb6825d25885b34106aab79d6c9853.tar.bz2
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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/fast-export.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 7734a9f..66331fa 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';