summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2014-11-08 17:45:38 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2014-11-08 17:45:38 -0500
commit4865cc3f0631a8a4e0e1de897865df0e552c70cb (patch)
treee2730325f0b4e88b616edd2d239cc209a7eb96c6 /src
parent02bc5233041ba0b83fc8db66e02214c99f1e75fe (diff)
parente284c451b0d7c3ddac383eb35f2c36cb3859eb32 (diff)
downloadlibgit2-4865cc3f0631a8a4e0e1de897865df0e552c70cb.tar.gz
Merge pull request #2673 from swisspol/2672
Fixed GIT_REMOTE_DOWNLOAD_TAGS_ALL to behave like git 1.9.0+
Diffstat (limited to 'src')
-rw-r--r--src/fetch.c12
-rw-r--r--src/remote.c26
2 files changed, 20 insertions, 18 deletions
diff --git a/src/fetch.c b/src/fetch.c
index 9ff95d935..f61685619 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -28,15 +28,15 @@ static int maybe_want(git_remote *remote, git_remote_head *head, git_odb *odb, g
if (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 tagopt is --tags, always request tags
+ * in addition to the remote's refspecs
*/
if (git_refspec_src_matches(tagspec, head->name))
match = 1;
- else
- return 0;
- } else if (git_remote__matching_refspec(remote, head->name))
- match = 1;
+ }
+
+ if (!match && git_remote__matching_refspec(remote, head->name))
+ match = 1;
if (!match)
return 0;
diff --git a/src/remote.c b/src/remote.c
index 220695413..cc9f85cd1 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -1098,24 +1098,26 @@ static int update_tips_for_spec(
if (!git_reference_is_valid_name(head->name))
continue;
- if (git_refspec_src_matches(spec, head->name) && spec->dst) {
- if (git_refspec_transform(&refname, spec, head->name) < 0)
- goto on_error;
- } else if (remote->download_tags != GIT_REMOTE_DOWNLOAD_TAGS_NONE) {
+ if (git_refspec_src_matches(&tagspec, head->name)) {
+ if (remote->download_tags != GIT_REMOTE_DOWNLOAD_TAGS_NONE) {
- if (remote->download_tags != GIT_REMOTE_DOWNLOAD_TAGS_ALL)
- autotag = 1;
+ if (remote->download_tags == GIT_REMOTE_DOWNLOAD_TAGS_AUTO)
+ autotag = 1;
- if (!git_refspec_src_matches(&tagspec, head->name))
+ git_buf_clear(&refname);
+ if (git_buf_puts(&refname, head->name) < 0)
+ goto on_error;
+ } else {
continue;
-
- git_buf_clear(&refname);
- if (git_buf_puts(&refname, head->name) < 0)
+ }
+ } else if (git_refspec_src_matches(spec, head->name) && spec->dst) {
+ if (git_refspec_transform(&refname, spec, head->name) < 0)
goto on_error;
} else {
continue;
}
+ /* In autotag mode, only create tags for objects already in db */
if (autotag && !git_odb_exists(odb, &head->oid))
continue;
@@ -1276,8 +1278,8 @@ int git_remote_update_tips(
goto out;
if (remote->download_tags == GIT_REMOTE_DOWNLOAD_TAGS_ALL) {
- error = update_tips_for_spec(remote, &tagspec, &refs, signature, reflog_message);
- goto out;
+ if ((error = update_tips_for_spec(remote, &tagspec, &refs, signature, reflog_message)) < 0)
+ goto out;
}
git_vector_foreach(&remote->active_refspecs, i, spec) {