summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2010-04-20 01:31:31 +0200
committerJunio C Hamano <gitster@pobox.com>2010-04-19 16:39:24 -0700
commit111fb858654b95355da05772b4dcdf91decc4721 (patch)
tree22d8b2a67491085d2c2b33598883f04d7920ae7a /builtin
parent944163a4bd4cc4c35392147d10020ba57c6d7d87 (diff)
downloadgit-111fb858654b95355da05772b4dcdf91decc4721.tar.gz
remote add: add a --[no-]tags option
Add '--[no-]tags' options to 'git remote add' which add the 'remote.REMOTE.tagopt = --[no-]tags' to the configuration file. This mimics the "--tags" and "--no-tags" options of "git fetch". Signed-off-by: Samuel Tardieu <sam@rfc1149.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/remote.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/builtin/remote.c b/builtin/remote.c
index 277765b864..0e99a9957d 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -104,9 +104,15 @@ static int fetch_remote(const char *name)
return 0;
}
+enum {
+ TAGS_UNSET = 0,
+ TAGS_DEFAULT = 1,
+ TAGS_SET = 2
+};
+
static int add(int argc, const char **argv)
{
- int fetch = 0, mirror = 0;
+ int fetch = 0, mirror = 0, fetch_tags = TAGS_DEFAULT;
struct string_list track = { NULL, 0, 0 };
const char *master = NULL;
struct remote *remote;
@@ -116,6 +122,11 @@ static int add(int argc, const char **argv)
struct option options[] = {
OPT_BOOLEAN('f', "fetch", &fetch, "fetch the remote branches"),
+ OPT_SET_INT(0, "tags", &fetch_tags,
+ "import all tags and associated objects when fetching",
+ TAGS_SET),
+ OPT_SET_INT(0, NULL, &fetch_tags,
+ "or do not fetch any tag at all (--no-tags)", TAGS_UNSET),
OPT_CALLBACK('t', "track", &track, "branch",
"branch(es) to track", opt_parse_track),
OPT_STRING('m', "master", &master, "branch", "master branch"),
@@ -172,6 +183,14 @@ static int add(int argc, const char **argv)
return 1;
}
+ if (fetch_tags != TAGS_DEFAULT) {
+ strbuf_reset(&buf);
+ strbuf_addf(&buf, "remote.%s.tagopt", name);
+ if (git_config_set(buf.buf,
+ fetch_tags == TAGS_SET ? "--tags" : "--no-tags"))
+ return 1;
+ }
+
if (fetch && fetch_remote(name))
return 1;