Merge branch 'jk/maint-decorate-01-bool'
authorJunio C Hamano <gitster@pobox.com>
Wed, 8 Dec 2010 19:24:14 +0000 (11:24 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Dec 2010 19:24:14 +0000 (11:24 -0800)
* jk/maint-decorate-01-bool:
log.decorate: accept 0/1 bool values

1  2 
config.c
t/t4202-log.sh
diff --combined config.c
index f138c34721b4751f3e8b0a1d10680f70ebfa2741,9918b9351d8b8b9b33fea479bd4f4997a5d6528a..32c0b2c41e01a754060e73bbf20a7f0e9c43bb10
+++ 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;
        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 a8c33d57031db00cc096a80861ecfb7e72faa635,2043bb8867cec2c2b4a431cca1f5762f10fa5ba5..2fcc31a6f3d346e533b697eecf853e219d174cd0
@@@ -191,7 -191,7 +191,7 @@@ test_expect_success 'git show <commits
  test_expect_success 'setup case sensitivity tests' '
        echo case >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 &&
        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 &&