git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [EGIT PATCH 2/6] Peel annotated tags when getting all refs

From
Shawn O. Pearce <spearce@spearce.org>
Date
Oct 6, 2008, 07:43 UTC
Message-ID
<20081006074303.GB27516@spearce.org>
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.
...
Show 12 quoted lines
> 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.
Previous: Shawn O. Pearce
Message 14 of 14 in “(unknown)”
  1. Robin RosenbergOct 5, 2008
  2. 1/6 Keep original ref name when reading refsRobin Rosenberg, Oct 5, 2008
  3. 2/6 Peel annotated tags when getting all refsRobin Rosenberg, Oct 5, 2008
  4. 3/6 Add a method to get refs by object IdRobin Rosenberg, Oct 5, 2008
  5. 4/6 Add tags to the graphical history display.Robin Rosenberg, Oct 5, 2008
  6. 5/6 Add decorate option to log programRobin Rosenberg, Oct 5, 2008
  7. 6/6 Comment the getId method and hint for copy to actually get an ObjectIdRobin Rosenberg, Oct 5, 2008
  8. Shawn O. PearceOct 6, 2008
  9. Robin RosenbergOct 6, 2008
  10. Shawn O. PearceOct 6, 2008
  11. Shawn O. PearceOct 6, 2008
  12. Robin RosenbergOct 6, 2008
  13. Shawn O. PearceOct 6, 2008
  14. Shawn O. PearceOct 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.