aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-03-30 15:53:39 -0400
committerJunio C Hamano <gitster@pobox.com>2011-03-30 13:47:54 -0700
commit099024861021830f9d4c7db4c64c844bf9d5ebd9 (patch)
tree68450eef9548d03599cb3e0a4d416a9965fa46f8 /builtin
parenta9f5a3558dcf83440c60ae5a2e2b56c80d65bb0b (diff)
downloadgit-099024861021830f9d4c7db4c64c844bf9d5ebd9.tar.gz
git-099024861021830f9d4c7db4c64c844bf9d5ebd9.tar.xz
remote: deprecate --mirror
The configuration created by plain --mirror is dangerous and useless, and we now have --mirror=fetch and --mirror=push to replace it. Let's warn the user. One alternative to this is to try to guess which type the user wants. In a non-bare repository, a fetch mirror doesn't make much sense, since it would overwrite local commits. But in a bare repository, you might use either type, or even both (e.g., if you are acting as an intermediate drop-point across two disconnected networks). So rather than try for complex heuristics, let's keep it simple. The user knows what they're trying to do, so let them tell us. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/remote.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/builtin/remote.c b/builtin/remote.c
index f9522d5d8..eb1229d68 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -136,13 +136,19 @@ static int add_branch(const char *key, const char *branchname,
return git_config_set_multivar(key, tmp->buf, "^$", 0);
}
+static const char mirror_advice[] =
+"--mirror is dangerous and deprecated; please\n"
+"\t use --mirror=fetch or --mirror=push instead";
+
static int parse_mirror_opt(const struct option *opt, const char *arg, int not)
{
unsigned *mirror = opt->value;
if (not)
*mirror = MIRROR_NONE;
- else if (!arg)
+ else if (!arg) {
+ warning("%s", mirror_advice);
*mirror = MIRROR_BOTH;
+ }
else if (!strcmp(arg, "fetch"))
*mirror = MIRROR_FETCH;
else if (!strcmp(arg, "push"))