All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Rosenberg <robin.rosenberg.lists@dewire.com>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org
Subject: Re: [JGIT PATCH 05/11] Don't advertise HEAD from ReceivePack
Date: Tue, 21 Jul 2009 17:22:09 +0200	[thread overview]
Message-ID: <200907211722.09631.robin.rosenberg.lists@dewire.com> (raw)
In-Reply-To: <1247343566-19025-6-git-send-email-spearce@spearce.org>

lördag 11 juli 2009 22:19:20 skrev "Shawn O. Pearce" <spearce@spearce.org>:
> The HEAD ref cannot be pushed to by a client, if it is a detached HEAD
> the client shouldn't be permitted to change it, if it is a symref to
> another ref then the client should update the destination ref and not
> the symref.  Instead offer the HEAD ref as a ".have" line, which is an
> invalid ref that the client can't update but still lets the client know
> we have its target object reachable.
> 
> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
> ---
>  .../org/spearce/jgit/transport/ReceivePack.java    |    5 ++++-
>  .../org/spearce/jgit/transport/RefAdvertiser.java  |   15 +++++++++++++++
>  2 files changed, 19 insertions(+), 1 deletions(-)
> 
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/ReceivePack.java b/org.spearce.jgit/src/org/spearce/jgit/transport/ReceivePack.java
> index fd8aa86..1c490af 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/transport/ReceivePack.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/ReceivePack.java
> @@ -509,8 +509,11 @@ private void sendAdvertisedRefs() throws IOException {
>  		adv.advertiseCapability(CAPABILITY_REPORT_STATUS);
>  		if (allowOfsDelta)
>  			adv.advertiseCapability(CAPABILITY_OFS_DELTA);
> -		refs = db.getAllRefs();
> +		refs = new HashMap<String, Ref>(db.getAllRefs());
> +		final Ref head = refs.remove(Constants.HEAD);
>  		adv.send(refs.values());
> +		if (head != null && head.getName() == head.getOrigName())
> +			adv.advertiseHave(head.getObjectId());

This relies on an implicit guarantee that == works here. Would equals cost
too much? Or perhaps we should document this guarantee as part of the
interface.

-- robin

  parent reply	other threads:[~2009-07-21 15:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-11 20:19 [JGIT PATCH 00/11] Repository instance caching Shawn O. Pearce
2009-07-11 20:19 ` [JGIT PATCH 01/11] Change Daemon to use concurrent collections for exported repositories Shawn O. Pearce
2009-07-11 20:19   ` [JGIT PATCH 02/11] Make Daemon's exportAll check not require synchronization Shawn O. Pearce
2009-07-11 20:19     ` [JGIT PATCH 03/11] Don't retry ".git" suffix in daemon if already tried Shawn O. Pearce
2009-07-11 20:19       ` [JGIT PATCH 04/11] Refactor ref advertisement code from server implementations Shawn O. Pearce
2009-07-11 20:19         ` [JGIT PATCH 05/11] Don't advertise HEAD from ReceivePack Shawn O. Pearce
2009-07-11 20:19           ` [JGIT PATCH 06/11] Add a use reference counter to Repository Shawn O. Pearce
2009-07-11 20:19             ` [JGIT PATCH 07/11] Introduce RepositoryCache to cache handles of Repository objects Shawn O. Pearce
2009-07-11 20:19               ` [JGIT PATCH 08/11] Change Daemon to use RepositoryCache Shawn O. Pearce
2009-07-11 20:19                 ` [JGIT PATCH 09/11] Expose the Repository's ObjectDatabase object Shawn O. Pearce
2009-07-11 20:19                   ` [JGIT PATCH 10/11] Use cached Repository instances when resolving alternates Shawn O. Pearce
2009-07-11 20:19                     ` [JGIT PATCH 11/11] Send .have lines in ReceivePack for alternate repositories Shawn O. Pearce
2009-07-21 15:22           ` Robin Rosenberg [this message]
2009-07-21 15:28             ` [JGIT PATCH 05/11] Don't advertise HEAD from ReceivePack Shawn O. Pearce

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=200907211722.09631.robin.rosenberg.lists@dewire.com \
    --to=robin.rosenberg.lists@dewire.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.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 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.