From: Jeff King <peff@peff.net>
To: Jan Hudec <bulb@ucw.cz>
Cc: git@vger.kernel.org
Subject: Re: [BUG?] push to mirrior interferes with parallel operations
Date: Thu, 18 Nov 2010 14:04:15 -0500 [thread overview]
Message-ID: <20101118190414.GA30438@sigill.intra.peff.net> (raw)
In-Reply-To: <20101118184241.GN3693@efreet.light.src>
On Thu, Nov 18, 2010 at 07:42:41PM +0100, Jan Hudec wrote:
> The above config is what is created by default by 'git remote add --mirror'.
> So I expect the problem to be somewhat common with mirror and a lot rarer
> without.
Agreed, and I think just turning off the behavior with "mirror" might be
OK in practice. But I do want to consider whether we can make other
corner cases more sensible at the same time.
> Which brings the yet another question, namely whether it actually makes sense
> to set the fetch for a mirror remote. Note that any call to fetch will almost
> inevitably abort with "reusing to pull to checked out ref in non-bare
> repository" error.
Hmm. Yeah, of the "fetch vs push mirror" distinction I made earlier, it
really only makes sense to push from a non-bare repo, and to fetch into
a bare repo.
> [skip some thoughtful analysis which I agree with, but I think ends up
> not being relevant]
>
> In fact the problem is not in the race, but in the fact, that push updates
> refs, that may have other purpose than tracking the particular remote. The
> problem is in some cases we don't know whether a ref is purely tracking
> *that* remote or not.
Yeah, you're right. I think the real problem is that we generally assume
that by putting something on the RHS of a fetch refspec, it is used just
for tracking the particular remote (especially when there is a "+" on
the front!).
So the real solution is not having that fetch line.
> and the third option (similar to the first, but done at different point):
>
> 3. Don't set 'fetch' for mirror remotes in non-bare repositories, since
> non-bare repositories can't be treated as mirrors of something.
Of all the options, this is my favorite. It does what we want in the
common cases, it's simple, and it still allows people to hand-config
crazy stuff if they want to.
It doesn't un-break people's existing repos, but I think we can accept
that (actually, the docs say that --mirror only makes sense in bare
repositories. Which I think is not true, as you demonstrate, but perhaps
it dissuaded people from creating broken push mirrors in the past :) ).
That does still leave one slight corner case, which is a bare repo that
is used for both fetch and push mirrors. E.g., a repo that straddles the
border between two networks might do:
git init --bare
git remote add --mirror network1 host.network1:foo.git
git remote add --mirror network2 host.network2:foo.git
git fetch network1
git push network2
to relay commits. Both remotes will have the fetch refspec, as they are
in a bare repo. But only the first one wants it. In the second one, we
will update the heads as tracking refs. A simultaneous fetch/push would
be in conflict.
That is such an unlikely case that we can probably just leave it to be
hand-configured by anybody who really wants it. Or we can have:
# adds fetch = refs/*:refs/*
git remote add --mirror=fetch network1 host.network1:foo.git
# adds push = refs/*:refs/*
git remote add --mirror=push network2 host.network2:foo.git
and the default for --mirror (with no type) can be "fetch" in a bare repo
and "push" in a non-bare one.
-Peff
next prev parent reply other threads:[~2010-11-18 19:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-18 7:39 [BUG?] push to mirrior interferes with parallel operations Jan Hudec
2010-11-18 17:50 ` Jeff King
2010-11-18 17:58 ` Jeff King
2010-11-18 18:49 ` Does it make sense to pull from mirror? (Re: [BUG?] push to mirrior interferes with parallel operations) Jan Hudec
2010-11-18 19:05 ` Jeff King
2010-11-18 18:42 ` [BUG?] push to mirrior interferes with parallel operations Jan Hudec
2010-11-18 19:04 ` Jeff King [this message]
2010-11-19 19:40 ` Andreas Schwab
2010-11-19 19:46 ` Jeff King
2010-11-19 21:18 ` Andreas Schwab
2010-11-19 21:21 ` Jeff King
2010-11-19 21:29 ` Andreas Schwab
2010-11-19 21:51 ` Jeff King
2010-11-19 21:32 ` Jonathan Nieder
2010-11-19 21:54 ` 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=20101118190414.GA30438@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=bulb@ucw.cz \
--cc=git@vger.kernel.org \
/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).