From: Junio C Hamano Date: Wed, 18 Feb 2015 19:45:03 +0000 (-0800) Subject: Merge branch 'jc/push-cert' X-Git-Tag: v2.4.0-rc0~106 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/74f45dfd78661a84fcff81e616ef6c154deadcb9?hp=-c Merge branch 'jc/push-cert' "git push --signed" gave an incorrectly worded error message when the other side did not support the capability. * jc/push-cert: transport-helper: fix typo in error message when --signed is not supported --- 74f45dfd78661a84fcff81e616ef6c154deadcb9 diff --combined transport-helper.c index 27c82f73ac,356165821f..7441d5d515 --- a/transport-helper.c +++ b/transport-helper.c @@@ -108,12 -108,17 +108,12 @@@ static struct child_process *get_helper int refspec_alloc = 0; int duped; int code; - char git_dir_buf[sizeof(GIT_DIR_ENVIRONMENT) + PATH_MAX + 1]; - const char *helper_env[] = { - git_dir_buf, - NULL - }; - if (data->helper) return data->helper; - helper = xcalloc(1, sizeof(*helper)); + helper = xmalloc(sizeof(*helper)); + child_process_init(helper); helper->in = -1; helper->out = -1; helper->err = 0; @@@ -123,8 -128,8 +123,8 @@@ helper->git_cmd = 0; helper->silent_exec_failure = 1; - snprintf(git_dir_buf, sizeof(git_dir_buf), "%s=%s", GIT_DIR_ENVIRONMENT, get_git_dir()); - helper->env = helper_env; + argv_array_pushf(&helper->env_array, "%s=%s", GIT_DIR_ENVIRONMENT, + get_git_dir()); code = start_command(helper); if (code < 0 && errno == ENOENT) @@@ -356,8 -361,7 +356,8 @@@ static int fetch_with_fetch(struct tran continue; strbuf_addf(&buf, "fetch %s %s\n", - sha1_to_hex(posn->old_sha1), posn->name); + sha1_to_hex(posn->old_sha1), + posn->symref ? posn->symref : posn->name); } strbuf_addch(&buf, '\n'); @@@ -392,7 -396,7 +392,7 @@@ static int get_importer(struct transpor struct child_process *helper = get_helper(transport); struct helper_data *data = transport->data; int cat_blob_fd, code; - memset(fastimport, 0, sizeof(*fastimport)); + child_process_init(fastimport); fastimport->in = helper->out; argv_array_push(&fastimport->args, "fast-import"); argv_array_push(&fastimport->args, debug ? "--stats" : "--quiet"); @@@ -415,7 -419,7 +415,7 @@@ static int get_exporter(struct transpor struct child_process *helper = get_helper(transport); int i; - memset(fastexport, 0, sizeof(*fastexport)); + child_process_init(fastexport); /* we need to duplicate helper->in because we want to use it after * fastexport is done with it. */ @@@ -455,8 -459,7 +455,8 @@@ static int fetch_with_import(struct tra if (posn->status & REF_STATUS_UPTODATE) continue; - strbuf_addf(&buf, "import %s\n", posn->name); + strbuf_addf(&buf, "import %s\n", + posn->symref ? posn->symref : posn->name); sendline(data, &buf); strbuf_reset(&buf); } @@@ -489,15 -492,14 +489,15 @@@ * fast-forward or this is a forced update. */ for (i = 0; i < nr_heads; i++) { - char *private; + char *private, *name; posn = to_fetch[i]; if (posn->status & REF_STATUS_UPTODATE) continue; + name = posn->symref ? posn->symref : posn->name; if (data->refspecs) - private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name); + private = apply_refspecs(data->refspecs, data->refspec_nr, name); else - private = xstrdup(posn->name); + private = xstrdup(name); if (private) { read_ref(private, posn->old_sha1); free(private); @@@ -863,7 -865,7 +863,7 @@@ static int push_refs_with_export(struc die("helper %s does not support dry-run", data->name); } else if (flags & TRANSPORT_PUSH_CERT) { if (set_helper_option(transport, TRANS_OPT_PUSH_CERT, "true") != 0) - die("helper %s does not support dry-run", data->name); + die("helper %s does not support --signed", data->name); } if (flags & TRANSPORT_PUSH_FORCE) { @@@ -894,10 -896,7 +894,10 @@@ int flag; /* Follow symbolic refs (mainly for HEAD). */ - name = resolve_ref_unsafe(ref->peer_ref->name, sha1, 1, &flag); + name = resolve_ref_unsafe( + ref->peer_ref->name, + RESOLVE_REF_READING, + sha1, &flag); if (!name || !(flag & REF_ISSYMREF)) name = ref->peer_ref->name;