summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a9f5a35)
raw | patch | inline | side by side (parent: a9f5a35)
author | Jeff King <peff@peff.net> | |
Wed, 30 Mar 2011 19:53:39 +0000 (15:53 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 30 Mar 2011 20:47:54 +0000 (13:47 -0700) |
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>
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>
Documentation/git-remote.txt | patch | blob | history | |
builtin/remote.c | patch | blob | history |
index 79e38fedd7efffb1a07f6d82ce4325a81136ed6f..ddcbcc00aeaf43f830a7f33c3302ec3843e9e197 100644 (file)
+
When a push mirror is created with `\--mirror=push`, then `git push`
will always behave as if `\--mirror` was passed.
-+
-The option `\--mirror` (with no type) sets up both push and fetch
-mirror configuration. It is kept for historical purposes, and is
-probably not what you want.
'rename'::
diff --git a/builtin/remote.c b/builtin/remote.c
index f9522d5d8befd743c63bd5d9c07d9796116b1bcb..eb1229d68917131e98c4830fa184045f82fcedad 100644 (file)
--- a/builtin/remote.c
+++ b/builtin/remote.c
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"))