Commit e3e017d4 by Carlos Martín Nieto

remote: don't confuse tag auto-follow rules with refspec matching

When we're looking to update a tag, we can't stop if the tag auto-follow
rules don't say to update it. The tag might still match the refspec we
were given.
parent a8792767
...@@ -1334,11 +1334,13 @@ static int update_tips_for_spec( ...@@ -1334,11 +1334,13 @@ static int update_tips_for_spec(
for (; i < refs->length; ++i) { for (; i < refs->length; ++i) {
head = git_vector_get(refs, i); head = git_vector_get(refs, i);
autotag = 0; autotag = 0;
git_buf_clear(&refname);
/* Ignore malformed ref names (which also saves us from tag^{} */ /* Ignore malformed ref names (which also saves us from tag^{} */
if (!git_reference_is_valid_name(head->name)) if (!git_reference_is_valid_name(head->name))
continue; continue;
/* If we have a tag, see if the auto-follow rules say to update it */
if (git_refspec_src_matches(&tagspec, head->name)) { if (git_refspec_src_matches(&tagspec, head->name)) {
if (tagopt != GIT_REMOTE_DOWNLOAD_TAGS_NONE) { if (tagopt != GIT_REMOTE_DOWNLOAD_TAGS_NONE) {
...@@ -1348,10 +1350,11 @@ static int update_tips_for_spec( ...@@ -1348,10 +1350,11 @@ static int update_tips_for_spec(
git_buf_clear(&refname); git_buf_clear(&refname);
if (git_buf_puts(&refname, head->name) < 0) if (git_buf_puts(&refname, head->name) < 0)
goto on_error; goto on_error;
} else {
continue;
} }
} else if (git_refspec_src_matches(spec, head->name)) { }
/* If we didn't want to auto-follow the tag, check if the refspec matches */
if (!autotag && git_refspec_src_matches(spec, head->name)) {
if (spec->dst) { if (spec->dst) {
if (git_refspec_transform(&refname, spec, head->name) < 0) if (git_refspec_transform(&refname, spec, head->name) < 0)
goto on_error; goto on_error;
...@@ -1365,7 +1368,10 @@ static int update_tips_for_spec( ...@@ -1365,7 +1368,10 @@ static int update_tips_for_spec(
continue; continue;
} }
} else { }
/* If we still don't have a refname, we don't want it */
if (git_buf_len(&refname) == 0) {
continue; continue;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment