From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: git@vger.kernel.org
Cc: spearce@spearce.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [EGIT PATCH 2/6] Peel annotated tags when getting all refs
Date: Mon, 6 Oct 2008 01:36:38 +0200 [thread overview]
Message-ID: <1223249802-9959-3-git-send-email-robin.rosenberg@dewire.com> (raw)
In-Reply-To: <1223249802-9959-2-git-send-email-robin.rosenberg@dewire.com>
For packed refs we got this automatically from packed-refs,
but for loose tags we have to follow the tags and get the leaf
object in order to comply with the documentation.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../src/org/spearce/jgit/lib/RefDatabase.java | 24 ++++++++++++++++++-
1 files changed, 22 insertions(+), 2 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 5a1b85f..1ee70d9 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RefDatabase.java
@@ -271,7 +271,16 @@ private void readOneLooseRef(final Map<String, Ref> avail,
return;
}
- ref = new Ref(Ref.Storage.LOOSE, origName, refName, id);
+ Object tt = db.mapObject(id, refName);
+ if (tt != null && tt instanceof Tag) {
+ Tag t = (Tag)tt;
+ while (t != null && t.getType().equals(Constants.TYPE_TAG))
+ t = db.mapTag(t.getTag(), t.getObjId());
+ if (t != null)
+ ref = new Ref(Ref.Storage.LOOSE, origName, refName, id, t.getObjId());
+ } else
+ ref = new Ref(Ref.Storage.LOOSE, origName, refName, id);
+
looseRefs.put(ref.getName(), ref);
looseRefsMTime.put(ref.getName(), ent.lastModified());
avail.put(ref.getName(), ref);
@@ -363,7 +372,18 @@ private Ref readRefBasic(final String origName, final String name, final int dep
throw new IOException("Not a ref: " + name + ": " + line);
}
- ref = new Ref(Ref.Storage.LOOSE, origName, name, id);
+ Object tt = db.mapObject(id, origName);
+ if (tt != null && tt instanceof Tag) {
+ Tag t = (Tag)tt;
+ while (t != null && t.getType().equals(Constants.TYPE_TAG))
+ t = db.mapTag(t.getTag(), t.getObjId());
+ if (t != null)
+ ref = new Ref(Ref.Storage.LOOSE, origName, name, id, t.getObjId());
+ } else
+ ref = new Ref(Ref.Storage.LOOSE, origName, name, id);
+
+ looseRefs.put(origName, ref);
+ ref = new Ref(Ref.Storage.LOOSE, origName, id);
looseRefs.put(name, ref);
looseRefsMTime.put(name, mtime);
return ref;
--
1.6.0.1.310.gf789d0.dirty
next prev parent reply other threads:[~2008-10-05 23:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-05 23:36 (unknown), Robin Rosenberg
2008-10-05 23:36 ` [EGIT PATCH 1/6] Keep original ref name when reading refs Robin Rosenberg
2008-10-05 23:36 ` Robin Rosenberg [this message]
2008-10-05 23:36 ` [EGIT PATCH 3/6] Add a method to get refs by object Id Robin Rosenberg
2008-10-05 23:36 ` [EGIT PATCH 4/6] Add tags to the graphical history display Robin Rosenberg
2008-10-05 23:36 ` [EGIT PATCH 5/6] Add decorate option to log program Robin Rosenberg
2008-10-05 23:36 ` [EGIT PATCH 6/6] Comment the getId method and hint for copy to actually get an ObjectId Robin Rosenberg
2008-10-06 8:08 ` [EGIT PATCH 4/6] Add tags to the graphical history display Shawn O. Pearce
2008-10-06 21:58 ` Robin Rosenberg
2008-10-06 22:14 ` Shawn O. Pearce
2008-10-06 8:15 ` [EGIT PATCH 3/6] Add a method to get refs by object Id Shawn O. Pearce
2008-10-06 22:37 ` Robin Rosenberg
2008-10-06 22:43 ` Shawn O. Pearce
2008-10-06 7:43 ` [EGIT PATCH 2/6] Peel annotated tags when getting all refs Shawn O. Pearce
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=1223249802-9959-3-git-send-email-robin.rosenberg@dewire.com \
--to=robin.rosenberg@dewire.com \
--cc=git@vger.kernel.org \
--cc=spearce@spearce.org \
/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).