summaryrefslogtreecommitdiff
path: root/src/remote.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-09-30 10:56:06 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2012-09-30 12:05:28 +0200
commit3230a44f4c951cbaeadfa5ae111f6558298dfc61 (patch)
tree2a07a140b7e6352ab6f97d5ca382eafd4ed96dcd /src/remote.c
parenteb0bd77a8892b77b8eaa57da2f827981c62bc161 (diff)
downloadlibgit2-3230a44f4c951cbaeadfa5ae111f6558298dfc61.tar.gz
remote: support downloading all tags
Also honor remote.$name.tagopt = --tags.
Diffstat (limited to 'src/remote.c')
-rw-r--r--src/remote.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/remote.c b/src/remote.c
index f446cfe48..fd78164f3 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -47,6 +47,8 @@ static int download_tags_value(git_remote *remote, git_config *cfg)
git_buf_free(&buf);
if (!error && !strcmp(val, "--no-tags"))
remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_NONE;
+ else if (!error && !strcmp(val, "--tags"))
+ remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_ALL;
if (error == GIT_ENOTFOUND)
error = 0;
@@ -455,7 +457,6 @@ int git_remote_update_tips(git_remote *remote)
git_remote_head *head;
git_reference *ref;
struct git_refspec *spec;
- char *tagstr = "refs/tags/*:refs/tags/*";
git_refspec tagspec;
assert(remote);
@@ -469,7 +470,7 @@ int git_remote_update_tips(git_remote *remote)
if (git_repository_odb(&odb, remote->repo) < 0)
return -1;
- if (git_refspec__parse(&tagspec, tagstr, true) < 0)
+ if (git_refspec__parse(&tagspec, GIT_REFSPEC_TAGS, true) < 0)
return -1;
/* HEAD is only allowed to be the first in the list */
@@ -500,7 +501,9 @@ int git_remote_update_tips(git_remote *remote)
if (git_refspec_transform_r(&refname, spec, head->name) < 0)
goto on_error;
} else if (remote->download_tags != GIT_REMOTE_DOWNLOAD_TAGS_NONE) {
- autotag = 1;
+
+ if (remote->download_tags != GIT_REMOTE_DOWNLOAD_TAGS_ALL)
+ autotag = 1;
if (!git_refspec_src_matches(&tagspec, head->name))
continue;