diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-05-07 16:01:22 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-05-07 18:49:47 +0200 |
commit | 505b5d0c815a9b8f78bf7267e57ea433f04d0b6b (patch) | |
tree | b26198aae77490fe59d8882d5131b697e99fab83 /src/fetch.c | |
parent | 33665410d636c9f5f0d5e017fe6347260b1b6ec1 (diff) | |
download | libgit2-505b5d0c815a9b8f78bf7267e57ea433f04d0b6b.tar.gz |
remote: correctly interpret tagopt '--tags'
When tagopt is set to '--tags', we should only take the default tags
refspec into account and ignore any configured ones.
Bring the code into compliance.
Diffstat (limited to 'src/fetch.c')
-rw-r--r-- | src/fetch.c | 12 |
1 files changed, 9 insertions, 3 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) |