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

Re: [PATCH] Implement packed refs

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 14, 2007, 22:45 UTC
Message-ID
<20070514224533.GA28832@spearce.org>
In-Reply-To
<11790995571637-git-send-email-robin.rosenberg@dewire.com>
Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
Show 13 quoted lines
> diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
> index 76191be..3b2a82c 100644
> @@ -411,6 +412,10 @@ public class Repository {
>  	private Ref readRefBasic(String name) throws IOException {
>  		int depth = 0;
>  		REF_READING: do {
> +			ObjectId id = packedRefs.get(name);
> +			if (id != null)
> +				return new Ref(null, id);
> +
>  			final File f = new File(getDirectory(), name);
>  			if (!f.isFile()) {
>  				return new Ref(f, null);

This is actually backwards. Git checks the loose ref first, and then the packed ref. The reason is so that users can pack all of their refs (git pack-refs --all) and then just create new ref files for those that they change, rather than rewriting the entire packed-refs file over again.

I'm adding a commit after your series to correct this.
> +		} catch (IOException e) {
> +			e.printStackTrace();
> +		}

We really should be throwing exceptions back to the caller, especially on things that could indicate corruption or other problems with reading the repository contents.

-- 
Shawn.
Previous: Robin RosenbergNext: Robin Rosenberg
Message 6 of 13 in “This week in EGIT - more tags”
  1. Robin RosenbergMay 13, 2007
  2. Implement simple tagsRobin Rosenberg, May 13, 2007
  3. Write refs when creating tagsRobin Rosenberg, May 13, 2007
  4. Implement packed refsRobin Rosenberg, May 13, 2007
  5. Show tags in history viewRobin Rosenberg, May 13, 2007
  6. Shawn O. PearceMay 14, 2007
  7. Robin RosenbergMay 14, 2007
  8. The first patch in the seriesRobin Rosenberg, May 13, 2007
  9. Require JDK1.5Robin Rosenberg, May 13, 2007
  10. Grzegorz KulewskiMay 14, 2007
  11. Noel GrandinMay 14, 2007
  12. Robin RosenbergMay 14, 2007
  13. Set required execution enviromentRobin Rosenberg, May 14, 2007

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.