[PATCH v5 4/5] fast-export: differentiate between explicitly utf-8 and implicitly utf-8
- From
Elijah Newren <newren@gmail.com>
- Date
- May 13, 2019, 23:17 UTC
- Message-ID
- <20190513231726.16218-5-newren@gmail.com>
- In-Reply-To
- <20190513231726.16218-1-newren@gmail.com>
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> --- 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