Merge branch 'ma/parse-maybe-bool'
authorJunio C Hamano <gitster@pobox.com>
Tue, 22 Aug 2017 17:29:03 +0000 (10:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 22 Aug 2017 17:29:03 +0000 (10:29 -0700)
Code clean-up.

* ma/parse-maybe-bool:
  parse_decoration_style: drop unused argument `var`
  treewide: deprecate git_config_maybe_bool, use git_parse_maybe_bool
  config: make git_{config,parse}_maybe_bool equivalent
  config: introduce git_parse_maybe_bool_text
  t5334: document that git push --signed=1 does not work
  Doc/git-{push,send-pack}: correct --sign= to --signed=

12 files changed:
1  2 
Documentation/git-push.txt
Documentation/git-send-pack.txt
builtin/log.c
builtin/merge.c
builtin/pull.c
builtin/push.c
builtin/remote.c
builtin/send-pack.c
config.c
pager.c
submodule-config.c
t/t5534-push-signed.sh

Simple merge
Simple merge
diff --cc builtin/log.c
@@@ -53,14 -52,9 +53,14 @@@ struct line_opt_callback_data 
        struct string_list args;
  };
  
- static int parse_decoration_style(const char *var, const char *value)
 +static int auto_decoration_style(void)
 +{
 +      return (isatty(1) || pager_in_use()) ? DECORATE_SHORT_REFS : 0;
 +}
 +
+ static int parse_decoration_style(const char *value)
  {
-       switch (git_config_maybe_bool(var, value)) {
+       switch (git_parse_maybe_bool(value)) {
        case 1:
                return DECORATE_SHORT_REFS;
        case 0:
diff --cc builtin/merge.c
Simple merge
diff --cc builtin/pull.c
Simple merge
diff --cc builtin/push.c
Simple merge
Simple merge
Simple merge
diff --cc config.c
+++ b/config.c
@@@ -921,15 -709,7 +921,15 @@@ unsigned long git_config_ulong(const ch
        return ret;
  }
  
- int git_parse_maybe_bool(const char *value)
 +ssize_t git_config_ssize_t(const char *name, const char *value)
 +{
 +      ssize_t ret;
 +      if (!git_parse_ssize_t(value, &ret))
 +              die_bad_number(name, value);
 +      return ret;
 +}
 +
+ static int git_parse_maybe_bool_text(const char *value)
  {
        if (!value)
                return 1;
diff --cc pager.c
Simple merge
@@@ -267,47 -234,6 +267,47 @@@ int parse_fetch_recurse_submodules_arg(
        return parse_fetch_recurse(opt, arg, 1);
  }
  
-       switch (git_config_maybe_bool(opt, arg)) {
 +int option_fetch_parse_recurse_submodules(const struct option *opt,
 +                                        const char *arg, int unset)
 +{
 +      int *v;
 +
 +      if (!opt->value)
 +              return -1;
 +
 +      v = opt->value;
 +
 +      if (unset) {
 +              *v = RECURSE_SUBMODULES_OFF;
 +      } else {
 +              if (arg)
 +                      *v = parse_fetch_recurse_submodules_arg(opt->long_name, arg);
 +              else
 +                      *v = RECURSE_SUBMODULES_ON;
 +      }
 +      return 0;
 +}
 +
 +static int parse_update_recurse(const char *opt, const char *arg,
 +                              int die_on_error)
 +{
++      switch (git_parse_maybe_bool(arg)) {
 +      case 1:
 +              return RECURSE_SUBMODULES_ON;
 +      case 0:
 +              return RECURSE_SUBMODULES_OFF;
 +      default:
 +              if (die_on_error)
 +                      die("bad %s argument: %s", opt, arg);
 +              return RECURSE_SUBMODULES_ERROR;
 +      }
 +}
 +
 +int parse_update_recurse_submodules_arg(const char *opt, const char *arg)
 +{
 +      return parse_update_recurse(opt, arg, 1);
 +}
 +
  static int parse_push_recurse(const char *opt, const char *arg,
                               int die_on_error)
  {
Simple merge