From: "Shawn O. Pearce" <spearce@spearce.org>
To: Daniel Barkalow <barkalow@iabervon.org>
Cc: Junio C Hamano <gitster@pobox.com>, Theodore Tso <tytso@MIT.EDU>,
Jon Smirl <jonsmirl@gmail.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Alternates and push
Date: Mon, 8 Sep 2008 07:56:54 -0700 [thread overview]
Message-ID: <20080908145654.GC10252@spearce.org> (raw)
In-Reply-To: <alpine.LNX.1.00.0809080246520.19665@iabervon.org>
Daniel Barkalow <barkalow@iabervon.org> wrote:
> On Sun, 7 Sep 2008, Junio C Hamano wrote:
> >
> > Oops, I forgot to Cc Daniel. Shawn also CC'ed because he will have the
> > same issue with the smart CGI based http-push he is building.
Not just the smart CGI based http-push thingy. JGit is impacted
anytime we start talking about network transport. ;-)
> > The sending end, however, has a safety to silently ignore malformed refs
> > it learns from the receiving end over the wire. So the current sender
> > won't work with asterisk in there '*', nor full-pathname, because
> > typically it contains "/.git/" in the string, which would make it an
> > invalid refname to be ignored.
> >
> > Also, the sending end remembers the objects we have per refname, so
> > sending two records with the same refname pointing at two different
> > objects will not work well either (the current code is loose and does not
> > check duplicates, but that is not a feature by design but is an accident).
Cute. Learn something new every day.
JGit doesn't do the check_ref_format(), but it does do duplicate
detection. If the remote side sends us duplicate advertisements
JGit freaks out and aborts the transfer. This is largely just a
function of JGit hashing the advertised refs for O(1) access later
on during processing. We avoid a lot of ugly O(N^2) loops that way.
> I think we should use a really invalid ref name, like "^" or something
> like that, so that it's clearly not an actually available ref, but just a
> way for the remote to mention that it has the object, and the remote
> doesn't have to try to make it unique.
I agree. How about just calling all of these ".have"?
According to check_ref_format() it fails, so older clients will
just ignore it. Attempts by bad clients to push or delete ".have"
should also fail automatically in receive-pack's own test at the
start of the update() function.
Using a constant name for all instances hides what the underlying
alternates really have, in case their branches aren't public, but
their databases are. It also makes it easier for hashing clients
like JGit to collect these object IDs into a table of known objects,
but ignoring the name component.
Sadly no matter what we do here JGit's duplicate detection is in
direct opposite behavior with git.git's ignoring check_ref_format()
failures. So we'll have to patch JGit no matter what we do.
--
Shawn.
prev parent reply other threads:[~2008-09-08 14:58 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-06 12:42 Alternates and push Jon Smirl
2008-09-06 16:20 ` Theodore Tso
2008-09-06 18:06 ` Junio C Hamano
2008-09-06 18:24 ` Jon Smirl
2008-09-06 19:21 ` Shawn O. Pearce
2008-09-09 8:35 ` Petr Baudis
2008-09-09 14:57 ` Shawn O. Pearce
2008-09-07 18:49 ` Jan Hudec
2008-09-07 18:56 ` Junio C Hamano
2008-09-07 19:17 ` Jan Hudec
2008-09-07 19:18 ` Junio C Hamano
2008-09-08 17:56 ` Jan Hudec
2008-09-07 23:41 ` Theodore Tso
2008-09-08 0:02 ` Junio C Hamano
2008-09-08 0:41 ` Theodore Tso
2008-09-08 2:53 ` Junio C Hamano
2008-09-08 5:07 ` Junio C Hamano
2008-09-08 6:42 ` Junio C Hamano
2008-09-08 7:24 ` Daniel Barkalow
2008-09-08 14:56 ` Shawn O. Pearce [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=20080908145654.GC10252@spearce.org \
--to=spearce@spearce.org \
--cc=barkalow@iabervon.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jonsmirl@gmail.com \
--cc=tytso@MIT.EDU \
/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).