[JGIT PATCH 1/2] Fix missing packed-refs entries during ref lookup/enumeration

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

 



Some codepaths in RefDatabase allowed the caller to lookup a ref
without making sure the packed-refs file was loaded into memory.
This caused refs which were only packed to appear to not exist,
which meant fetch would still try to fetch something we already
have had for quite some time.

This resolves the issue I was seeing where `jgit fetch` was always
downloading the stable branch of egit.git, even though it has not
changed in many weeks.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../src/org/spearce/jgit/lib/RefDatabase.java      |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

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 82b995e..98c365e 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
@@ -115,6 +115,7 @@ class RefDatabase {
 	}
 
 	ObjectId idOf(final String name) throws IOException {
+		refreshPackedRefs();
 		final Ref r = readRefBasic(name, 0);
 		return r != null ? r.getObjectId() : null;
 	}
@@ -132,6 +133,7 @@ class RefDatabase {
 	 *             to the base ref, as the symbolic ref could not be read.
 	 */
 	RefUpdate newUpdate(final String name) throws IOException {
+		refreshPackedRefs();
 		Ref r = readRefBasic(name, 0);
 		if (r == null)
 			r = new Ref(Ref.Storage.NEW, name, null);
-- 
1.6.0.rc0.182.gb96c7

--
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