diff options
Diffstat (limited to 'src/fetch.c')
| -rw-r--r-- | src/fetch.c | 18 |
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; } |
