All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Robin Rosenberg <robin.rosenberg@dewire.com>
Cc: git@vger.kernel.org
Subject: Re: [EGIT PATCH 2/6] Peel annotated tags when getting all refs
Date: Mon, 6 Oct 2008 00:43:03 -0700	[thread overview]
Message-ID: <20081006074303.GB27516@spearce.org> (raw)
In-Reply-To: <1223249802-9959-3-git-send-email-robin.rosenberg@dewire.com>

FWIW I'm still going through the series.  But this jumped out at me.

Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> For packed refs we got this automatically from packed-refs,
> but for loose tags we have to follow the tags and get the leaf
> object in order to comply with the documentation.
...
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
> index 5a1b85f..1ee70d9 100644
> --- a/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
> +++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
> @@ -271,7 +271,16 @@ private void readOneLooseRef(final Map<String, Ref> avail,
>  					return;
>  				}
>  
> -				ref = new Ref(Ref.Storage.LOOSE, origName, refName, id);
> +				Object tt = db.mapObject(id, refName);
> +				if (tt != null && tt instanceof Tag) {
> +					Tag t = (Tag)tt;

Owwww.

I don't want to be doing peeling of loose annotated tags anytime
we loop through the loose objects.  That is just painful and very
expensive.  I'd rather the peeling be caused on demand by callers
who need it, but if its done through a method on Repository then
we can push the peeled ObjectId back into the RefDatabase cache.

I'm thinking more like:

	Repository db = ...;
	...
	ObjectId p = ref.getPeeledObjectId()
	if (p == null)
		p = db.peel(ref)

-- 
Shawn.

      parent reply	other threads:[~2008-10-06  7:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-05 23:36 (unknown), Robin Rosenberg
2008-10-05 23:36 ` [EGIT PATCH 1/6] Keep original ref name when reading refs Robin Rosenberg
2008-10-05 23:36   ` [EGIT PATCH 2/6] Peel annotated tags when getting all refs Robin Rosenberg
2008-10-05 23:36     ` [EGIT PATCH 3/6] Add a method to get refs by object Id Robin Rosenberg
2008-10-05 23:36       ` [EGIT PATCH 4/6] Add tags to the graphical history display Robin Rosenberg
2008-10-05 23:36         ` [EGIT PATCH 5/6] Add decorate option to log program Robin Rosenberg
2008-10-05 23:36           ` [EGIT PATCH 6/6] Comment the getId method and hint for copy to actually get an ObjectId Robin Rosenberg
2008-10-06  8:08         ` [EGIT PATCH 4/6] Add tags to the graphical history display Shawn O. Pearce
2008-10-06 21:58           ` Robin Rosenberg
2008-10-06 22:14             ` Shawn O. Pearce
2008-10-06  8:15       ` [EGIT PATCH 3/6] Add a method to get refs by object Id Shawn O. Pearce
2008-10-06 22:37         ` Robin Rosenberg
2008-10-06 22:43           ` Shawn O. Pearce
2008-10-06  7:43     ` 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=20081006074303.GB27516@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.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.