diff options
| author | Carlos Martín Nieto <carlos@cmartin.tk> | 2012-09-15 08:07:24 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <carlos@cmartin.tk> | 2012-09-30 11:56:38 +0200 |
| commit | 24f2f94e7defd20ab302c30d0d394248a6e43814 (patch) | |
| tree | ef3bfbac718823254d407021d1240da840200865 /src/remote.c | |
| parent | c128149315c67d52c4503e294bfbd2653e0a8307 (diff) | |
| download | libgit2-24f2f94e7defd20ab302c30d0d394248a6e43814.tar.gz | |
fetch: use the include-tag capability
This tells the remote to send us any tags that point to objects that
we are downloading.
Diffstat (limited to 'src/remote.c')
| -rw-r--r-- | src/remote.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/remote.c b/src/remote.c index 0ae47c364..2eb2fd1b7 100644 --- a/src/remote.c +++ b/src/remote.c @@ -55,6 +55,31 @@ static int parse_remote_refspec(git_config *cfg, git_refspec *refspec, const cha return refspec_parse(refspec, val); } +static int download_tags_value(git_remote *remote, git_config *cfg) +{ + const char *val; + git_buf buf = GIT_BUF_INIT; + int error; + + if (remote->download_tags != GIT_REMOTE_DOWNLOAD_TAGS_UNSET) + return 0; + + /* This is the default, let's see if we need to change it */ + remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_AUTO; + if (git_buf_printf(&buf, "remote.%s.tagopt", remote->name) < 0) + return -1; + + error = git_config_get_string(&val, cfg, git_buf_cstr(&buf)); + git_buf_free(&buf); + if (!error && !strcmp(val, "--no-tags")) + remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_NONE; + + if (error == GIT_ENOTFOUND) + error = 0; + + return error; +} + int git_remote_new(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch) { git_remote *remote; @@ -181,6 +206,9 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name) goto cleanup; } + if (download_tags_value(remote, config) < 0) + goto cleanup; + *out = remote; cleanup: |
