public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
* [JGIT PATCH] Rename RevTag.getName() to RevTag.getTagName()
@ 2009-08-12 19:39 Shawn O. Pearce
  2009-08-12 20:37 ` Robin Rosenberg
  0 siblings, 1 reply; 3+ messages in thread
From: Shawn O. Pearce @ 2009-08-12 19:39 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git

The method getName() conflicts semantically with the method name()
we have inherited from our base class, ObjectId.  It is a rather
unfortunate turn of events that for performance reasons we wind up
subclassing what should be a property of this class, but since we
do that we need to pay attention to the methods declared on our
base class.

We want to use getName() to be a mirror of name() on AnyObjectId,
as it has a more JavaBeans style feel to the accessing of that
particular value.  So, rename getTagName() so it doesn't wind up
conflicting with the SHA-1 hex formatted string.

Noticed-by: Alex Blewitt <alex.blewitt@gmail•com>
Signed-off-by: Shawn O. Pearce <spearce@spearce•org>
---
 .../src/org/spearce/jgit/revwalk/RevTag.java       |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevTag.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevTag.java
index 2fab266..51ff49b 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevTag.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RevTag.java
@@ -56,7 +56,7 @@
 
 	private byte[] buffer;
 
-	private String name;
+	private String tagName;
 
 	/**
 	 * Create a new tag reference.
@@ -96,7 +96,7 @@ void parseCanonical(final RevWalk walk, final byte[] rawTag)
 
 		int p = pos.value += 4; // "tag "
 		final int nameEnd = RawParseUtils.nextLF(rawTag, p) - 1;
-		name = RawParseUtils.decode(Constants.CHARSET, rawTag, p, nameEnd);
+		tagName = RawParseUtils.decode(Constants.CHARSET, rawTag, p, nameEnd);
 
 		if (walk.isRetainBody())
 			buffer = rawTag;
@@ -186,7 +186,7 @@ public final String getShortMessage() {
 	 * @return parsed tag.
 	 */
 	public Tag asTag(final RevWalk walk) {
-		return new Tag(walk.db, this, name, buffer);
+		return new Tag(walk.db, this, tagName, buffer);
 	}
 
 	/**
@@ -204,7 +204,7 @@ public final RevObject getObject() {
 	 * @return name of the tag, according to the tag header.
 	 */
 	public final String getName() {
-		return name;
+		return tagName;
 	}
 
 	final void disposeBody() {
-- 
1.6.4.225.gb589e

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

end of thread, other threads:[~2009-08-12 20:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-12 19:39 [JGIT PATCH] Rename RevTag.getName() to RevTag.getTagName() Shawn O. Pearce
2009-08-12 20:37 ` Robin Rosenberg
2009-08-12 20:51   ` [JGIT PATCH v2] " 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