Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2019-10-04 22:25:50 +0300
committerJunio C Hamano <gitster@pobox.com>2019-10-06 03:43:01 +0300
commitb181676ce9e8c89a39737f098d9b9c4f774596cf (patch)
tree5612964e16a91ef7526722af951065970f7ad8f7 /convert.c
parentaeb582a98374c094361cba1bd756dc6307432c42 (diff)
convert: fix handling of dashless UTF prefix in validate_encoding()
Strip "UTF" and an optional dash from the start of 'upper' without passing a NULL pointer to skip_prefix() in the second call, as it cannot handle that. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'convert.c')
-rw-r--r--convert.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/convert.c b/convert.c
index 5d0307fc10..8646ee46a3 100644
--- a/convert.c
+++ b/convert.c
@@ -289,8 +289,8 @@ static int validate_encoding(const char *path, const char *enc,
const char *stripped = NULL;
char *upper = xstrdup_toupper(enc);
upper[strlen(upper)-2] = '\0';
- if (!skip_prefix(upper, "UTF-", &stripped))
- skip_prefix(stripped, "UTF", &stripped);
+ if (skip_prefix(upper, "UTF", &stripped))
+ skip_prefix(stripped, "-", &stripped);
advise(advise_msg, path, stripped);
free(upper);
if (die_on_error)
@@ -309,8 +309,8 @@ static int validate_encoding(const char *path, const char *enc,
"working-tree-encoding.");
const char *stripped = NULL;
char *upper = xstrdup_toupper(enc);
- if (!skip_prefix(upper, "UTF-", &stripped))
- skip_prefix(stripped, "UTF", &stripped);
+ if (skip_prefix(upper, "UTF", &stripped))
+ skip_prefix(stripped, "-", &stripped);
advise(advise_msg, path, stripped, stripped);
free(upper);
if (die_on_error)