Merge branch 'sb/plug-transport-leak'
authorJunio C Hamano <gitster@pobox.com>
Fri, 24 Oct 2014 22:00:09 +0000 (15:00 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Oct 2014 22:00:09 +0000 (15:00 -0700)
Code clean-up.

* sb/plug-transport-leak:
.mailmap: add Stefan Bellers corporate mail address
transport: free leaking head in transport_print_push_status()

1  2 
transport.c
diff --combined transport.c
index b56620ed7f63aa12716e5168d817722716e6d89d,cb62cb68861635df45b6c3b3db1e1bcf5e281db2..70d38e4c4b35c6207e226ab7cb54095c34bb4766
@@@ -168,8 -168,7 +168,8 @@@ static void set_upstreams(struct transp
                /* Follow symbolic refs (mainly for HEAD). */
                localname = ref->peer_ref->name;
                remotename = ref->name;
 -              tmp = resolve_ref_unsafe(localname, sha, 1, &flag);
 +              tmp = resolve_ref_unsafe(localname, RESOLVE_REF_READING,
 +                                       sha, &flag);
                if (tmp && flag & REF_ISSYMREF &&
                        starts_with(tmp, "refs/heads/"))
                        localname = tmp;
@@@ -202,7 -201,7 +202,7 @@@ static struct ref *get_refs_via_rsync(s
  {
        struct strbuf buf = STRBUF_INIT, temp_dir = STRBUF_INIT;
        struct ref dummy = {NULL}, *tail = &dummy;
 -      struct child_process rsync;
 +      struct child_process rsync = CHILD_PROCESS_INIT;
        const char *args[5];
        int temp_dir_len;
  
        strbuf_addstr(&buf, rsync_url(transport->url));
        strbuf_addstr(&buf, "/refs");
  
 -      memset(&rsync, 0, sizeof(rsync));
        rsync.argv = args;
        rsync.stdout_to_stderr = 1;
        args[0] = "rsync";
  static int fetch_objs_via_rsync(struct transport *transport,
                                int nr_objs, struct ref **to_fetch)
  {
 -      struct child_process rsync;
 +      struct child_process rsync = CHILD_PROCESS_INIT;
  
 -      memset(&rsync, 0, sizeof(rsync));
        rsync.stdout_to_stderr = 1;
        argv_array_push(&rsync.args, "rsync");
        argv_array_push(&rsync.args, (transport->verbose > 1) ? "-rv" : "-r");
@@@ -326,7 -327,7 +326,7 @@@ static int rsync_transport_push(struct 
  {
        struct strbuf buf = STRBUF_INIT, temp_dir = STRBUF_INIT;
        int result = 0, i;
 -      struct child_process rsync;
 +      struct child_process rsync = CHILD_PROCESS_INIT;
        const char *args[10];
  
        if (flags & TRANSPORT_PUSH_MIRROR)
        strbuf_addstr(&buf, rsync_url(transport->url));
        strbuf_addch(&buf, '/');
  
 -      memset(&rsync, 0, sizeof(rsync));
        rsync.argv = args;
        rsync.stdout_to_stderr = 1;
        i = 0;
@@@ -478,9 -480,6 +478,9 @@@ static int set_git_option(struct git_tr
                                die("transport: invalid depth option '%s'", value);
                }
                return 0;
 +      } else if (!strcmp(name, TRANS_OPT_PUSH_CERT)) {
 +              opts->push_cert = !!value;
 +              return 0;
        }
        return 1;
  }
@@@ -744,7 -743,7 +744,7 @@@ void transport_print_push_status(const 
        unsigned char head_sha1[20];
        char *head;
  
 -      head = resolve_refdup("HEAD", head_sha1, 1, NULL);
 +      head = resolve_refdup("HEAD", RESOLVE_REF_READING, head_sha1, NULL);
  
        if (verbose) {
                for (ref = refs; ref; ref = ref->next)
                        *reject_reasons |= REJECT_NEEDS_FORCE;
                }
        }
+       free(head);
  }
  
  void transport_verify_remote_names(int nr_heads, const char **heads)
@@@ -824,8 -824,6 +825,8 @@@ static int git_transport_push(struct tr
        args.progress = transport->progress;
        args.dry_run = !!(flags & TRANSPORT_PUSH_DRY_RUN);
        args.porcelain = !!(flags & TRANSPORT_PUSH_PORCELAIN);
 +      args.push_cert = !!(flags & TRANSPORT_PUSH_CERT);
 +      args.url = transport->url;
  
        ret = send_pack(&args, data->fd, data->conn, remote_refs,
                        &data->extra_have);
@@@ -1059,7 -1057,7 +1060,7 @@@ static int run_pre_push_hook(struct tra
  {
        int ret = 0, x;
        struct ref *r;
 -      struct child_process proc;
 +      struct child_process proc = CHILD_PROCESS_INIT;
        struct strbuf buf;
        const char *argv[4];
  
        argv[2] = transport->url;
        argv[3] = NULL;
  
 -      memset(&proc, 0, sizeof(proc));
        proc.argv = argv;
        proc.in = -1;