From: Jeff King <peff@peff.net>
To: chris <jugg@hotmail.com>
Cc: Jan Hudec <bulb@ucw.cz>, git@vger.kernel.org
Subject: [PATCH 3/3] remote: deprecate --mirror
Date: Wed, 30 Mar 2011 15:53:39 -0400 [thread overview]
Message-ID: <20110330195339.GC30624@sigill.intra.peff.net> (raw)
In-Reply-To: <20110330195139.GA814@sigill.intra.peff.net>
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>
---
Documentation/git-remote.txt | 4 ----
builtin/remote.c | 8 +++++++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index 28724a9..528f34a 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -75,10 +75,6 @@ because a fetch would overwrite any local commits.
+
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 570407f..8424152 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"))
--
1.7.4.2.8.g3ccd6
prev parent reply other threads:[~2011-03-30 19:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-30 2:27 checkout new branch tracks wrong remote (bug?) chris
2011-03-30 14:59 ` Jeff King
2011-03-30 19:51 ` [PATCH 0/3] better "remote add --mirror" semantics Jeff King
2011-03-30 19:52 ` [PATCH 1/3] remote: disallow some nonsensical option combinations Jeff King
2011-03-30 19:53 ` [PATCH 2/3] remote: separate the concept of push and fetch mirrors Jeff King
2011-03-30 20:45 ` Junio C Hamano
2011-03-30 20:57 ` Jeff King
2011-03-30 22:22 ` Junio C Hamano
2011-03-31 2:44 ` chris
2011-03-31 2:50 ` chris
2011-03-31 4:03 ` Junio C Hamano
2011-03-31 12:59 ` chris
2011-03-30 19:53 ` Jeff King [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110330195339.GC30624@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=bulb@ucw.cz \
--cc=git@vger.kernel.org \
--cc=jugg@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.