diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-09-15 16:09:47 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-09-15 16:09:47 -0700 |
| commit | ca20a44bc5dbed583b355c4a9a3c9ebf901a883d (patch) | |
| tree | eb130f154a99f02ddccdfb167dc921dd2b174e8e /builtin/fetch.c | |
| parent | Merge branch 'rs/add-p-worktree-mode-prompt-fix' (diff) | |
| parent | fetch: add branch.*.merge to default ref-prefix extension (diff) | |
| download | git-ca20a44bc5dbed583b355c4a9a3c9ebf901a883d.tar.gz git-ca20a44bc5dbed583b355c4a9a3c9ebf901a883d.zip | |
Merge branch 'jk/proto-v2-ref-prefix-fix'
"git fetch" over protocol v2 sent an incorrect ref prefix request
to the server and made "git pull" with configured fetch refspec
that does not cover the remote branch to merge with fail, which has
been corrected.
* jk/proto-v2-ref-prefix-fix:
fetch: add branch.*.merge to default ref-prefix extension
fetch: stop checking for NULL transport->remote in do_fetch()
Diffstat (limited to 'builtin/fetch.c')
| -rw-r--r-- | builtin/fetch.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index e6b926dba2..3aecbe4a3d 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1617,9 +1617,21 @@ static int do_fetch(struct transport *transport, break; } } - } else if (transport->remote && transport->remote->fetch.nr) - refspec_ref_prefixes(&transport->remote->fetch, - &transport_ls_refs_options.ref_prefixes); + } else { + struct branch *branch = branch_get(NULL); + + if (transport->remote->fetch.nr) + refspec_ref_prefixes(&transport->remote->fetch, + &transport_ls_refs_options.ref_prefixes); + if (branch_has_merge_config(branch) && + !strcmp(branch->remote_name, transport->remote->name)) { + int i; + for (i = 0; i < branch->merge_nr; i++) { + strvec_push(&transport_ls_refs_options.ref_prefixes, + branch->merge[i]->src); + } + } + } if (tags == TAGS_SET || tags == TAGS_DEFAULT) { must_list_refs = 1; |
