summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fetch.c12
-rw-r--r--src/remote.c28
2 files changed, 27 insertions, 13 deletions
diff --git a/src/fetch.c b/src/fetch.c
index 8ae34bddf..b5ec69777 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -34,10 +34,16 @@ static int filter_ref__cb(git_remote_head *head, void *payload)
if (!p->found_head && strcmp(head->name, GIT_HEAD_FILE) == 0)
p->found_head = 1;
- else if (git_remote__matching_refspec(p->remote, head->name))
+ else if (p->remote->download_tags == GIT_REMOTE_DOWNLOAD_TAGS_ALL) {
+ /*
+ * If tagopt is --tags, then we only use the default
+ * tags refspec and ignore the remote's
+ */
+ if (git_refspec_src_matches(p->tagspec, head->name))
match = 1;
- else if (p->remote->download_tags == GIT_REMOTE_DOWNLOAD_TAGS_ALL &&
- git_refspec_src_matches(p->tagspec, head->name))
+ else
+ return 0;
+ } else if (git_remote__matching_refspec(p->remote, head->name))
match = 1;
if (!match)
diff --git a/src/remote.c b/src/remote.c
index cba6b2548..692537636 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -957,30 +957,38 @@ on_error:
int git_remote_update_tips(git_remote *remote)
{
- git_refspec *spec;
+ git_refspec *spec, tagspec;
git_vector refs;
+ int error;
size_t i;
+
+ if (git_refspec__parse(&tagspec, GIT_REFSPEC_TAGS, true) < 0)
+ return -1;
+
if (git_vector_init(&refs, 16, NULL) < 0)
return -1;
- if (git_remote_ls(remote, store_refs, &refs) < 0)
- goto on_error;
+ if ((error = git_remote_ls(remote, store_refs, &refs)) < 0)
+ goto out;
+
+ if (remote->download_tags == GIT_REMOTE_DOWNLOAD_TAGS_ALL) {
+ error = update_tips_for_spec(remote, &tagspec, &refs);
+ goto out;
+ }
git_vector_foreach(&remote->refspecs, i, spec) {
if (spec->push)
continue;
- if (update_tips_for_spec(remote, spec, &refs) < 0)
- goto on_error;
+ if ((error = update_tips_for_spec(remote, spec, &refs)) < 0)
+ goto out;
}
+out:
+ git_refspec__free(&tagspec);
git_vector_free(&refs);
- return 0;
-
-on_error:
- git_vector_free(&refs);
- return -1;
+ return error;
}
int git_remote_connected(git_remote *remote)