git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [JGIT PATCH 1/2] Fix missing packed-refs entries during ref lookup/enumeration
@ 2008-07-27  4:33 Shawn O. Pearce
  2008-07-27  4:33 ` [JGIT PATCH 2/2] Teach fetch command line a --verbose/-v switch for unchanged refs Shawn O. Pearce
  0 siblings, 1 reply; 2+ messages in thread
From: Shawn O. Pearce @ 2008-07-27  4:33 UTC (permalink / raw)
  To: Robin Rosenberg, Marek Zawirski; +Cc: git

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@spearce.org>
---
 .../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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-27  4:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-27  4:33 [JGIT PATCH 1/2] Fix missing packed-refs entries during ref lookup/enumeration Shawn O. Pearce
2008-07-27  4:33 ` [JGIT PATCH 2/2] Teach fetch command line a --verbose/-v switch for unchanged refs Shawn O. Pearce

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