diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2019-05-16 08:57:10 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2019-05-22 11:47:30 +0200 |
commit | b83bd0379034eb16afae8753af41c0c7e25680b3 (patch) | |
tree | be8c9458234e41a83a718d8bb34224219697a5d2 | |
parent | 42dd38dd064cbc231073118113880502ab393c73 (diff) | |
download | libgit2-b83bd0379034eb16afae8753af41c0c7e25680b3.tar.gz |
config: don't write invalid column
When we don't specify a particular column, don't write it in the error
message. (column "0" is unhelpful.)
-rw-r--r-- | src/config_parse.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/config_parse.c b/src/config_parse.c index fde2ea0cc..6b162cbef 100644 --- a/src/config_parse.c +++ b/src/config_parse.c @@ -17,8 +17,15 @@ const char *git_config_escaped = "\n\t\b\"\\"; static void set_parse_error(git_config_parser *reader, int col, const char *error_str) { const char *file = reader->file ? reader->file->path : "in-memory"; - git_error_set(GIT_ERROR_CONFIG, "failed to parse config file: %s (in %s:%"PRIuZ", column %d)", - error_str, file, reader->ctx.line_num, col); + + if (col) + git_error_set(GIT_ERROR_CONFIG, + "failed to parse config file: %s (in %s:%"PRIuZ", column %d)", + error_str, file, reader->ctx.line_num, col); + else + git_error_set(GIT_ERROR_CONFIG, + "failed to parse config file: %s (in %s:%"PRIuZ")", + error_str, file, reader->ctx.line_num); } |