Code

Merge branch 'jk/maint-push-v-is-verbose'
authorJunio C Hamano <gitster@pobox.com>
Thu, 22 Dec 2011 19:27:29 +0000 (11:27 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 22 Dec 2011 19:27:29 +0000 (11:27 -0800)
* jk/maint-push-v-is-verbose:
  make "git push -v" actually verbose

1  2 
transport.c

diff --combined transport.c
index 63f38e3940516d9fd39371b4072ee296100307a7,35d9ce93ff1260aaec07b4ce7a207fbcbfa1f488..a99b7c9c457c4ac3b76dc6859507711f847e5f62
@@@ -10,7 -10,6 +10,7 @@@
  #include "refs.h"
  #include "branch.h"
  #include "url.h"
 +#include "submodule.h"
  
  /* rsync support */
  
@@@ -163,7 -162,7 +163,7 @@@ static void set_upstreams(struct transp
                /* Follow symbolic refs (mainly for HEAD). */
                localname = ref->peer_ref->name;
                remotename = ref->name;
 -              tmp = resolve_ref(localname, sha, 1, &flag);
 +              tmp = resolve_ref_unsafe(localname, sha, 1, &flag);
                if (tmp && flag & REF_ISSYMREF &&
                        !prefixcmp(tmp, "refs/heads/"))
                        localname = tmp;
@@@ -215,7 -214,7 +215,7 @@@ static struct ref *get_refs_via_rsync(s
        rsync.argv = args;
        rsync.stdout_to_stderr = 1;
        args[0] = "rsync";
-       args[1] = (transport->verbose > 0) ? "-rv" : "-r";
+       args[1] = (transport->verbose > 1) ? "-rv" : "-r";
        args[2] = buf.buf;
        args[3] = temp_dir.buf;
        args[4] = NULL;
@@@ -268,7 -267,7 +268,7 @@@ static int fetch_objs_via_rsync(struct 
        rsync.argv = args;
        rsync.stdout_to_stderr = 1;
        args[0] = "rsync";
-       args[1] = (transport->verbose > 0) ? "-rv" : "-r";
+       args[1] = (transport->verbose > 1) ? "-rv" : "-r";
        args[2] = "--ignore-existing";
        args[3] = "--exclude";
        args[4] = "info";
@@@ -351,7 -350,7 +351,7 @@@ static int rsync_transport_push(struct 
        args[i++] = "-a";
        if (flags & TRANSPORT_PUSH_DRY_RUN)
                args[i++] = "--dry-run";
-       if (transport->verbose > 0)
+       if (transport->verbose > 1)
                args[i++] = "-v";
        args[i++] = "--ignore-existing";
        args[i++] = "--exclude";
@@@ -432,8 -431,7 +432,8 @@@ static int fetch_refs_from_bundle(struc
                               int nr_heads, struct ref **to_fetch)
  {
        struct bundle_transport_data *data = transport->data;
 -      return unbundle(&data->header, data->fd);
 +      return unbundle(&data->header, data->fd,
 +                      transport->progress ? BUNDLE_VERBOSE : 0);
  }
  
  static int close_bundle(struct transport *transport)
@@@ -502,7 -500,7 +502,7 @@@ static struct ref *get_refs_via_connect
        struct ref *refs;
  
        connect_setup(transport, for_push, 0);
 -      get_remote_heads(data->fd[0], &refs, 0, NULL,
 +      get_remote_heads(data->fd[0], &refs,
                         for_push ? REF_NORMAL : 0, &data->extra_have);
        data->got_remote_heads = 1;
  
@@@ -527,7 -525,7 +527,7 @@@ static int fetch_refs_via_pack(struct t
        args.lock_pack = 1;
        args.use_thin_pack = data->options.thin;
        args.include_tag = data->options.followtags;
-       args.verbose = (transport->verbose > 0);
+       args.verbose = (transport->verbose > 1);
        args.quiet = (transport->verbose < 0);
        args.no_progress = !transport->progress;
        args.depth = data->options.depth;
  
        if (!data->got_remote_heads) {
                connect_setup(transport, 0, 0);
 -              get_remote_heads(data->fd[0], &refs_tmp, 0, NULL, 0, NULL);
 +              get_remote_heads(data->fd[0], &refs_tmp, 0, NULL);
                data->got_remote_heads = 1;
        }
  
@@@ -755,10 -753,18 +755,10 @@@ void transport_verify_remote_names(int 
                        continue;
  
                remote = remote ? (remote + 1) : local;
 -              switch (check_ref_format(remote)) {
 -              case 0: /* ok */
 -              case CHECK_REF_FORMAT_ONELEVEL:
 -                      /* ok but a single level -- that is fine for
 -                       * a match pattern.
 -                       */
 -              case CHECK_REF_FORMAT_WILDCARD:
 -                      /* ok but ends with a pattern-match character */
 -                      continue;
 -              }
 -              die("remote part of refspec is not a valid name in %s",
 -                  heads[i]);
 +              if (check_refname_format(remote,
 +                              REFNAME_ALLOW_ONELEVEL|REFNAME_REFSPEC_PATTERN))
 +                      die("remote part of refspec is not a valid name in %s",
 +                              heads[i]);
        }
  }
  
@@@ -772,7 -778,8 +772,7 @@@ static int git_transport_push(struct tr
                struct ref *tmp_refs;
                connect_setup(transport, 1, 0);
  
 -              get_remote_heads(data->fd[0], &tmp_refs, 0, NULL, REF_NORMAL,
 -                               NULL);
 +              get_remote_heads(data->fd[0], &tmp_refs, REF_NORMAL, NULL);
                data->got_remote_heads = 1;
        }
  
@@@ -906,7 -913,7 +906,7 @@@ struct transport *transport_get(struct 
                ret->fetch = fetch_objs_via_rsync;
                ret->push = rsync_transport_push;
                ret->smart_options = NULL;
 -      } else if (is_local(url) && is_file(url)) {
 +      } else if (is_local(url) && is_file(url) && is_bundle(url, 1)) {
                struct bundle_transport_data *data = xcalloc(1, sizeof(*data));
                ret->data = data;
                ret->get_refs_list = get_refs_from_bundle;
@@@ -980,7 -987,7 +980,7 @@@ int transport_set_option(struct transpo
  void transport_set_verbosity(struct transport *transport, int verbosity,
        int force_progress)
  {
-       if (verbosity >= 2)
+       if (verbosity >= 1)
                transport->verbose = verbosity <= 3 ? verbosity : 3;
        if (verbosity < 0)
                transport->verbose = -1;
@@@ -1025,8 -1032,8 +1025,8 @@@ int transport_push(struct transport *tr
                if (flags & TRANSPORT_PUSH_MIRROR)
                        match_flags |= MATCH_REFS_MIRROR;
  
 -              if (match_refs(local_refs, &remote_refs,
 -                             refspec_nr, refspec, match_flags)) {
 +              if (match_push_refs(local_refs, &remote_refs,
 +                                  refspec_nr, refspec, match_flags)) {
                        return -1;
                }
  
                        flags & TRANSPORT_PUSH_MIRROR,
                        flags & TRANSPORT_PUSH_FORCE);
  
 +              if ((flags & TRANSPORT_RECURSE_SUBMODULES_CHECK) && !is_bare_repository()) {
 +                      struct ref *ref = remote_refs;
 +                      for (; ref; ref = ref->next)
 +                              if (!is_null_sha1(ref->new_sha1) &&
 +                                  check_submodule_needs_pushing(ref->new_sha1,transport->remote->name))
 +                                      die("There are unpushed submodules, aborting.");
 +              }
 +
                push_ret = transport->push_refs(transport, remote_refs, flags);
                err = push_had_errors(remote_refs);
                ret = push_ret | err;