From: Junio C Hamano Date: Wed, 8 Dec 2010 19:24:14 +0000 (-0800) Subject: Merge branch 'jk/maint-decorate-01-bool' X-Git-Tag: v1.7.4-rc0~77 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/5e826019ef48e1d324c9a1866ed65f5be8990998?ds=inline;hp=-c Merge branch 'jk/maint-decorate-01-bool' * jk/maint-decorate-01-bool: log.decorate: accept 0/1 bool values --- 5e826019ef48e1d324c9a1866ed65f5be8990998 diff --combined config.c index f138c34721,9918b9351d..32c0b2c41e --- a/config.c +++ b/config.c @@@ -410,7 -410,7 +410,7 @@@ unsigned long git_config_ulong(const ch return ret; } - int git_config_maybe_bool(const char *name, const char *value) + static int git_config_maybe_bool_text(const char *name, const char *value) { if (!value) return 1; @@@ -427,9 -427,21 +427,21 @@@ return -1; } + int git_config_maybe_bool(const char *name, const char *value) + { + int v = git_config_maybe_bool_text(name, value); + if (0 <= v) + return v; + if (!strcmp(value, "0")) + return 0; + if (!strcmp(value, "1")) + return 1; + return -1; + } + int git_config_bool_or_int(const char *name, const char *value, int *is_bool) { - int v = git_config_maybe_bool(name, value); + int v = git_config_maybe_bool_text(name, value); if (0 <= v) { *is_bool = 1; return v; @@@ -489,13 -501,6 +501,13 @@@ static int git_default_core_config(cons return 0; } + if (!strcmp(var, "core.abbrevguard")) { + unique_abbrev_extra_length = git_config_int(var, value); + if (unique_abbrev_extra_length < 0) + unique_abbrev_extra_length = 0; + return 0; + } + if (!strcmp(var, "core.bare")) { is_bare_repository_cfg = git_config_bool(var, value); return 0; @@@ -878,7 -883,9 +890,7 @@@ int git_config(config_fn_t fn, void *da if (config_parameters) found += 1; - if (found == 0) - return -1; - return ret; + return ret == 0 ? found : ret; } /* diff --combined t/t4202-log.sh index a8c33d5703,2043bb8867..2fcc31a6f3 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@@ -191,7 -191,7 +191,7 @@@ test_expect_success 'git show one && test_tick && - git add one + git add one && git commit -a -m Second ' @@@ -341,7 -341,7 +341,7 @@@ test_expect_success 'set up more tangle test_commit octopus-b && git checkout master && test_commit seventh && - git merge octopus-a octopus-b + git merge octopus-a octopus-b && git merge reach ' @@@ -393,7 -393,7 +393,7 @@@ test_expect_success 'log --graph with m ' test_expect_success 'log.decorate configuration' ' - git config --unset-all log.decorate || : + test_might_fail git config --unset-all log.decorate && git log --oneline >expect.none && git log --oneline --decorate >expect.short && @@@ -421,6 -421,15 +421,15 @@@ git log --oneline --decorate=full >actual && test_cmp expect.full actual && + git config --unset-all log.decorate && + git config log.decorate 1 && + git log --oneline >actual && + test_cmp expect.short actual && + git log --oneline --decorate=full >actual && + test_cmp expect.full actual && + git log --oneline --decorate=no >actual && + test_cmp expect.none actual && + git config --unset-all log.decorate && git config log.decorate short && git log --oneline >actual &&