git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: chris <jugg@hotmail.com>, Jan Hudec <bulb@ucw.cz>, git@vger.kernel.org
Subject: Re: [PATCH 2/3] remote: separate the concept of push and fetch mirrors
Date: Wed, 30 Mar 2011 16:57:34 -0400	[thread overview]
Message-ID: <20110330205734.GA2940@sigill.intra.peff.net> (raw)
In-Reply-To: <7vhbakmj5k.fsf@alter.siamese.dyndns.org>

On Wed, Mar 30, 2011 at 01:45:59PM -0700, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > git-remote currently has one option, "--mirror", which sets
> > up mirror configuration which can be used for either
> > fetching or pushing. It looks like this:
> >
> >   [remote "mirror"]
> >     url = wherever
> >     fetch = +refs/*:refs/*
> >     mirror = true
> >
> > However, a remote like this can be dangerous and confusing.
> 
> When --mirror was introduced at 3894439 (Teach "git remote" a mirror mode,
> 2007-09-02), it was only about fetching into a bare repository from
> another repository and there wasn't any confusion.
> 
> I knew about this potential confusion when we applied 84bb2df (Add a
> remote.*.mirror configuration option, 2008-04-17), but chose to be lazy
> and ignored the issue, thinking that users are intelligent enough not to
> mix these obviously incompatible modes of operation.  If a repository is a
> mirror to fetch from somebody else, you wouldn't develop in it in the
> first place, and you would definitely not push it back to where you are
> mirroring from.  If a repository is mirrored into somewhere else to
> publish your work in there, you wouldn't be fetching back from there to
> obliterate your work.
> 
> Being explicit like your series does is much safer than relying on "common
> sense".

I think the problem is not that users lack common sense. It is that we
give them an option called "--mirror" that sets up a bogus config in
some circumstances. So it is the git developers who lack common sense, I
think. :)

Specifically, 84bb2df should not have started setting "remote.*.mirror",
as it was already about fetching into a bare repository. And probably
--mirror in a non-bare repo should have complained from the beginning.

But hey, hindsight is 20/20.

> I briefly wondered if this affects one use case where you want to
> configure a bare repository at your firewall boundary as a relay that
> mirrors an external public repository of somebody else by fetching and
> then publishes that to a repository internal to your network by pushing,
> but in that case you would have two remotes (the external --mirror=fetch
> one, and the internal --mirror=push one) that are separate, so it is not
> an issue.

Exactly. I almost said in the commit message for 3/3 that you would
never ever want to have both remote.*.mirror set to true _and_ have
remote.*.fetch set to "+refs/*:refs/*". Because by deprecating --mirror,
we are saying that situation is not useful.

But I really don't think it is. The only instance I could think of would
be a case where you have two backup repos, and you might sometimes
mirror in one direction and sometimes in the other depending on some
external factors (e.g., which one you were last able to connect to from
some third repo). But even then, I think I would use two separate repos.

Not to mention that "git remote" is supposed to be a friendly helper. If
you want to do something crazy, you're welcome to "git config" it
yourself. :)

> Thanks for cleaning up the two-year old mess.

No problem. Two complaints in recent memory triggered my "OK, I guess
this is biting people" instinct. :)

-Peff

  reply	other threads:[~2011-03-30 20:57 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 [this message]
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     ` [PATCH 3/3] remote: deprecate --mirror Jeff King

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=20110330205734.GA2940@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=bulb@ucw.cz \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).