diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-07-15 19:11:43 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-07-15 19:11:43 +0200 |
commit | f582dc3c5a7f891673387e5431b89e56e8b962ae (patch) | |
tree | ea60d12e8afc9aa794da8e14de7a890c8d9814bf /send-pack.c | |
parent | Merge branch 'ri/doc-show-branch-fix' (diff) | |
parent | push: avoid showing false negotiation errors (diff) | |
download | git-f582dc3c5a7f891673387e5431b89e56e8b962ae.tar.xz git-f582dc3c5a7f891673387e5431b89e56e8b962ae.zip |
Merge branch 'jc/disable-push-nego-for-deletion'
"git push" that pushes only deletion gave an unnecessary and
harmless error message when push negotiation is configured, which
has been corrected.
* jc/disable-push-nego-for-deletion:
push: avoid showing false negotiation errors
Diffstat (limited to 'send-pack.c')
-rw-r--r-- | send-pack.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/send-pack.c b/send-pack.c index 713da582d7..fa2f5eec17 100644 --- a/send-pack.c +++ b/send-pack.c @@ -427,17 +427,26 @@ static void get_commons_through_negotiation(const char *url, struct child_process child = CHILD_PROCESS_INIT; const struct ref *ref; int len = the_hash_algo->hexsz + 1; /* hash + NL */ + int nr_negotiation_tip = 0; child.git_cmd = 1; child.no_stdin = 1; child.out = -1; strvec_pushl(&child.args, "fetch", "--negotiate-only", NULL); for (ref = remote_refs; ref; ref = ref->next) { - if (!is_null_oid(&ref->new_oid)) - strvec_pushf(&child.args, "--negotiation-tip=%s", oid_to_hex(&ref->new_oid)); + if (!is_null_oid(&ref->new_oid)) { + strvec_pushf(&child.args, "--negotiation-tip=%s", + oid_to_hex(&ref->new_oid)); + nr_negotiation_tip++; + } } strvec_push(&child.args, url); + if (!nr_negotiation_tip) { + child_process_clear(&child); + return; + } + if (start_command(&child)) die(_("send-pack: unable to fork off fetch subprocess")); |