Merge branch 'ps/push-delete-option'
authorJunio C Hamano <gitster@pobox.com>
Tue, 12 Jan 2016 23:16:53 +0000 (15:16 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Jan 2016 23:16:54 +0000 (15:16 -0800)
"branch --delete" has "branch -d" but "push --delete" does not.

* ps/push-delete-option:
push: add '-d' as shorthand for '--delete'
push: add '--delete' flag to synopsis

1  2 
Documentation/git-push.txt
builtin/push.c
index 4c775bcec48360c3a097aea9cdb765ca9a9ec100,6f5d98c0eaed144ce67901c632b3f72292183c31..32482cec42d3ea5661813097919ff38657c2e01c
@@@ -10,7 -10,7 +10,7 @@@ SYNOPSI
  --------
  [verse]
  'git push' [--all | --mirror | --tags] [--follow-tags] [--atomic] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
-          [--repo=<repository>] [-f | --force] [--prune] [-v | --verbose]
+          [--repo=<repository>] [-f | --force] [-d | --delete] [--prune] [-v | --verbose]
           [-u | --set-upstream]
           [--[no-]signed|--sign=(true|false|if-asked)]
           [--force-with-lease[=<refname>[:<expect>]]]
@@@ -257,20 -257,16 +257,20 @@@ origin +master` to force a push to the 
        is specified. This flag forces progress status even if the
        standard error stream is not directed to a terminal.
  
 ---recurse-submodules=check|on-demand::
 -      Make sure all submodule commits used by the revisions to be
 -      pushed are available on a remote-tracking branch. If 'check' is
 -      used Git will verify that all submodule commits that changed in
 -      the revisions to be pushed are available on at least one remote
 -      of the submodule. If any commits are missing the push will be
 -      aborted and exit with non-zero status. If 'on-demand' is used
 -      all submodules that changed in the revisions to be pushed will
 -      be pushed. If on-demand was not able to push all necessary
 -      revisions it will also be aborted and exit with non-zero status.
 +--no-recurse-submodules::
 +--recurse-submodules=check|on-demand|no::
 +      May be used to make sure all submodule commits used by the
 +      revisions to be pushed are available on a remote-tracking branch.
 +      If 'check' is used Git will verify that all submodule commits that
 +      changed in the revisions to be pushed are available on at least one
 +      remote of the submodule. If any commits are missing the push will
 +      be aborted and exit with non-zero status. If 'on-demand' is used
 +      all submodules that changed in the revisions to be pushed will be
 +      pushed. If on-demand was not able to push all necessary revisions
 +      it will also be aborted and exit with non-zero status. A value of
 +      'no' or using '--no-recurse-submodules' can be used to override the
 +      push.recurseSubmodules configuration variable when no submodule
 +      recursion is required.
  
  --[no-]verify::
        Toggle the pre-push hook (see linkgit:githooks[5]).  The
diff --combined builtin/push.c
index 8963dbdf3da816bba595f7c4fcfdfd8bcdcd8670,093011dcf0f2c43e264520c2b8c71870b803d1f6..960ffc31e1537441a1120dceb120ce584b7edccf
@@@ -9,7 -9,6 +9,7 @@@
  #include "transport.h"
  #include "parse-options.h"
  #include "submodule.h"
 +#include "submodule-config.h"
  #include "send-pack.h"
  
  static const char * const push_usage[] = {
@@@ -22,7 -21,6 +22,7 @@@ static int deleterefs
  static const char *receivepack;
  static int verbosity;
  static int progress = -1;
 +static int recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
  
  static struct push_cas_option cas;
  
@@@ -454,14 -452,22 +454,14 @@@ static int do_push(const char *repo, in
  static int option_parse_recurse_submodules(const struct option *opt,
                                   const char *arg, int unset)
  {
 -      int *flags = opt->value;
 +      int *recurse_submodules = opt->value;
  
 -      if (*flags & (TRANSPORT_RECURSE_SUBMODULES_CHECK |
 -                    TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND))
 -              die("%s can only be used once.", opt->long_name);
 -
 -      if (arg) {
 -              if (!strcmp(arg, "check"))
 -                      *flags |= TRANSPORT_RECURSE_SUBMODULES_CHECK;
 -              else if (!strcmp(arg, "on-demand"))
 -                      *flags |= TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND;
 -              else
 -                      die("bad %s argument: %s", opt->long_name, arg);
 -      } else
 -              die("option %s needs an argument (check|on-demand)",
 -                              opt->long_name);
 +      if (unset)
 +              *recurse_submodules = RECURSE_SUBMODULES_OFF;
 +      else if (arg)
 +              *recurse_submodules = parse_push_recurse_submodules_arg(opt->long_name, arg);
 +      else
 +              die("%s missing parameter", opt->long_name);
  
        return 0;
  }
@@@ -516,10 -522,6 +516,10 @@@ static int git_push_config(const char *
                                        return error("Invalid value for '%s'", k);
                        }
                }
 +      } else if (!strcmp(k, "push.recursesubmodules")) {
 +              const char *value;
 +              if (!git_config_get_value("push.recursesubmodules", &value))
 +                      recurse_submodules = parse_push_recurse_submodules_arg(k, value);
        }
  
        return git_default_config(k, v, NULL);
@@@ -538,7 -540,7 +538,7 @@@ int cmd_push(int argc, const char **arg
                OPT_BIT( 0 , "all", &flags, N_("push all refs"), TRANSPORT_PUSH_ALL),
                OPT_BIT( 0 , "mirror", &flags, N_("mirror all refs"),
                            (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE)),
-               OPT_BOOL( 0, "delete", &deleterefs, N_("delete refs")),
+               OPT_BOOL('d', "delete", &deleterefs, N_("delete refs")),
                OPT_BOOL( 0 , "tags", &tags, N_("push tags (can't be used with --all or --mirror)")),
                OPT_BIT('n' , "dry-run", &flags, N_("dry run"), TRANSPORT_PUSH_DRY_RUN),
                OPT_BIT( 0,  "porcelain", &flags, N_("machine-readable output"), TRANSPORT_PUSH_PORCELAIN),
                  0, CAS_OPT_NAME, &cas, N_("refname>:<expect"),
                  N_("require old value of ref to be at this value"),
                  PARSE_OPT_OPTARG, parseopt_push_cas_option },
 -              { OPTION_CALLBACK, 0, "recurse-submodules", &flags, "check|on-demand",
 +              { OPTION_CALLBACK, 0, "recurse-submodules", &recurse_submodules, "check|on-demand|no",
                        N_("control recursive pushing of submodules"),
                        PARSE_OPT_OPTARG, option_parse_recurse_submodules },
                OPT_BOOL( 0 , "thin", &thin, N_("use thin pack")),
        if (deleterefs && argc < 2)
                die(_("--delete doesn't make sense without any refs"));
  
 +      if (recurse_submodules == RECURSE_SUBMODULES_CHECK)
 +              flags |= TRANSPORT_RECURSE_SUBMODULES_CHECK;
 +      else if (recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND)
 +              flags |= TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND;
 +
        if (tags)
                add_refspec("refs/tags/*");