git.vger.kernel.org archive mirror
 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: [PATCH] Implement packed refs
Date: Mon, 14 May 2007 18:45:33 -0400	[thread overview]
Message-ID: <20070514224533.GA28832@spearce.org> (raw)
In-Reply-To: <11790995571637-git-send-email-robin.rosenberg@dewire.com>

Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> 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.

  parent reply	other threads:[~2007-05-14 22:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-13 23:39 This week in EGIT - more tags Robin Rosenberg
2007-05-13 23:39 ` [PATCH] Implement simple tags Robin Rosenberg
2007-05-13 23:39   ` [PATCH] Write refs when creating tags Robin Rosenberg
2007-05-13 23:39     ` [PATCH] Implement packed refs Robin Rosenberg
2007-05-13 23:39       ` [PATCH] Show tags in history view Robin Rosenberg
2007-05-14 22:45       ` Shawn O. Pearce [this message]
2007-05-14 22:49         ` [PATCH] Implement packed refs Robin Rosenberg
2007-05-13 23:48   ` The first patch in the series Robin Rosenberg
2007-05-13 23:48     ` [PATCH] Require JDK1.5 Robin Rosenberg
2007-05-14  1:07       ` Grzegorz Kulewski
2007-05-14  7:21         ` Noel Grandin
2007-05-14 17:24           ` Robin Rosenberg
2007-05-14 20:56       ` [PATCH] Set required execution enviroment Robin Rosenberg

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=20070514224533.GA28832@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 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).