Merge branch 'jt/push-negotiation-fixes'

Bugfix for common ancestor negotiation recently introduced in "git
push" code path.

* jt/push-negotiation-fixes:
  fetch: die on invalid --negotiation-tip hash
  send-pack: fix push nego. when remote has refs
  send-pack: fix push.negotiate with remote helper
This commit is contained in:
Junio C Hamano
2021-08-24 15:32:40 -07:00
6 changed files with 96 additions and 4 deletions

View File

@@ -425,8 +425,10 @@ static void get_commons_through_negotiation(const char *url,
child.no_stdin = 1;
child.out = -1;
strvec_pushl(&child.args, "fetch", "--negotiate-only", NULL);
for (ref = remote_refs; ref; ref = ref->next)
strvec_pushf(&child.args, "--negotiation-tip=%s", oid_to_hex(&ref->new_oid));
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));
}
strvec_push(&child.args, url);
if (start_command(&child))