diff options
| author | Junio C Hamano <gitster@pobox.com> | 2019-10-09 14:01:00 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2019-10-09 14:01:00 +0900 |
| commit | d17f54947d9074e92bfbeabc05d5c39147456fe3 (patch) | |
| tree | 729b922e62f03885d1357042fd9f97909b1e83bf | |
| parent | Merge branch 'py/git-gui-has-maintainer' (diff) | |
| parent | convert: fix handling of dashless UTF prefix in validate_encoding() (diff) | |
| download | git-d17f54947d9074e92bfbeabc05d5c39147456fe3.tar.gz git-d17f54947d9074e92bfbeabc05d5c39147456fe3.zip | |
Merge branch 'rs/convert-fix-utf-without-dash'
The code to skip "UTF" and "UTF-" prefix, when computing an advice
message, did not work correctly when the prefix was "UTF", which
has been fixed.
* rs/convert-fix-utf-without-dash:
convert: fix handling of dashless UTF prefix in validate_encoding()
| -rw-r--r-- | convert.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -290,8 +290,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) @@ -310,8 +310,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) |
