diff options
| author | Carlos Martín Nieto <cmn@elego.de> | 2012-11-13 13:41:01 -0800 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@elego.de> | 2012-11-13 13:53:41 -0800 |
| commit | 47db054df053fb09c8c92edaa0238af2a2605e65 (patch) | |
| tree | b7a61fc24c910b0604a3493323d9064111d816b0 /src/util.c | |
| parent | 3ee078c0f7ed278be4839a6bde7dce29a614d336 (diff) | |
| download | libgit2-47db054df053fb09c8c92edaa0238af2a2605e65.tar.gz | |
config: distinguish between a lone variable name and one without rhs
'[section] variable' and '[section] variable =' behave differently
when parsed as booleans, so we need to store that distinction
internally.
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/util.c b/src/util.c index 0a82ccea6..7f5043817 100644 --- a/src/util.c +++ b/src/util.c @@ -432,12 +432,8 @@ int git__strcmp_cb(const void *a, const void *b) int git__parse_bool(int *out, const char *value) { /* A missing value means true */ - if (value == NULL) { - *out = 1; - return 0; - } - - if (!strcasecmp(value, "true") || + if (value == NULL || + !strcasecmp(value, "true") || !strcasecmp(value, "yes") || !strcasecmp(value, "on")) { *out = 1; @@ -445,7 +441,8 @@ int git__parse_bool(int *out, const char *value) } if (!strcasecmp(value, "false") || !strcasecmp(value, "no") || - !strcasecmp(value, "off")) { + !strcasecmp(value, "off") || + value[0] == '\0') { *out = 0; return 0; } |
