summaryrefslogtreecommitdiff
path: root/src/fetch.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-04-22 17:29:20 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-05-13 09:46:36 +0200
commit35a8a8c546fe3d0a5bc7df7cf418244133ccf238 (patch)
tree891e878a61ce7c0d17881171029c76c7d6c94430 /src/fetch.c
parent3eff2a57289ec19b1a805dd938299d1dcae47097 (diff)
downloadlibgit2-35a8a8c546fe3d0a5bc7df7cf418244133ccf238.tar.gz
remote: move the tagopt setting to the fetch options
This is another option which we should not be keeping in the remote, but is specific to each particular operation.
Diffstat (limited to 'src/fetch.c')
-rw-r--r--src/fetch.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/fetch.c b/src/fetch.c
index e59ae8621..82d86bbce 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -19,14 +19,14 @@
#include "repository.h"
#include "refs.h"
-static int maybe_want(git_remote *remote, git_remote_head *head, git_odb *odb, git_refspec *tagspec)
+static int maybe_want(git_remote *remote, git_remote_head *head, git_odb *odb, git_refspec *tagspec, git_remote_autotag_option_t tagopt)
{
int match = 0;
if (!git_reference_is_valid_name(head->name))
return 0;
- if (remote->download_tags == GIT_REMOTE_DOWNLOAD_TAGS_ALL) {
+ if (tagopt == GIT_REMOTE_DOWNLOAD_TAGS_ALL) {
/*
* If tagopt is --tags, always request tags
* in addition to the remote's refspecs
@@ -51,13 +51,17 @@ static int maybe_want(git_remote *remote, git_remote_head *head, git_odb *odb, g
return git_vector_insert(&remote->refs, head);
}
-static int filter_wants(git_remote *remote)
+static int filter_wants(git_remote *remote, const git_fetch_options *opts)
{
git_remote_head **heads;
git_refspec tagspec, head;
int error = 0;
git_odb *odb;
size_t i, heads_len;
+ git_remote_autotag_option_t tagopt = remote->download_tags;
+
+ if (opts && opts->download_tags != GIT_REMOTE_DOWNLOAD_TAGS_FALLBACK)
+ tagopt = opts->download_tags;
git_vector_clear(&remote->refs);
if ((error = git_refspec__parse(&tagspec, GIT_REFSPEC_TAGS, true)) < 0)
@@ -87,7 +91,7 @@ static int filter_wants(git_remote *remote)
goto cleanup;
for (i = 0; i < heads_len; i++) {
- if ((error = maybe_want(remote, heads[i], odb, &tagspec)) < 0)
+ if ((error = maybe_want(remote, heads[i], odb, &tagspec, tagopt)) < 0)
break;
}
@@ -102,13 +106,13 @@ cleanup:
* them out. When we get an ACK we hide that commit and continue
* traversing until we're done
*/
-int git_fetch_negotiate(git_remote *remote)
+int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts)
{
git_transport *t = remote->transport;
- remote->need_pack = 0;
+ remote->need_pack = 0;
- if (filter_wants(remote) < 0) {
+ if (filter_wants(remote, opts) < 0) {
giterr_set(GITERR_NET, "Failed to filter the reference list for wants");
return -1;
}