Re: [PATCH] Implement packed refs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robin Rosenberg <robin.rosenberg@xxxxxxxxxx> 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.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux