diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-06-07 08:37:57 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-07 10:30:49 -0700 |
| commit | 235ac3f81ad1950f2e6b47b30561eb96844e1c85 (patch) | |
| tree | 134a6940986f9decc562037f209499e890774a10 /builtin/fetch.c | |
| parent | reftable: cast away constness when assigning constants to records (diff) | |
| download | git-235ac3f81ad1950f2e6b47b30561eb96844e1c85.tar.gz git-235ac3f81ad1950f2e6b47b30561eb96844e1c85.zip | |
refspec: remove global tag refspec structure
We have a global tag refspec structure that is used by both git-clone(1)
and git-fetch(1). Initialization of the structure will break once we
enable `-Wwrite-strings`, even though the breakage is harmless. While we
could just add casts, the structure isn't really required in the first
place as we can simply initialize the structures at the respective
callsites.
Refactor the code accordingly.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch.c')
| -rw-r--r-- | builtin/fetch.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index 75255dc600..06b60867f5 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -582,11 +582,16 @@ static struct ref *get_ref_map(struct remote *remote, } } - if (tags == TAGS_SET) + if (tags == TAGS_SET) { + struct refspec_item tag_refspec; + /* also fetch all tags */ - get_fetch_map(remote_refs, tag_refspec, &tail, 0); - else if (tags == TAGS_DEFAULT && *autotags) + refspec_item_init(&tag_refspec, TAG_REFSPEC, 0); + get_fetch_map(remote_refs, &tag_refspec, &tail, 0); + refspec_item_clear(&tag_refspec); + } else if (tags == TAGS_DEFAULT && *autotags) { find_non_local_tags(remote_refs, NULL, &ref_map, &tail); + } /* Now append any refs to be updated opportunistically: */ *tail = orefs; |
