# [JGIT PATCH] Rename RevTag.getName() to RevTag.getTagName()

3 messages from 2009-08-12 to 2009-08-12. Participants: Shawn O. Pearce, Robin Rosenberg.
Thread: https://gitlist.dev/t/20559

## Shawn O. Pearce, 2009-08-12 19:39

Subject: [JGIT PATCH] Rename RevTag.getName() to RevTag.getTagName()
Message-ID: <1250105956-17795-1-git-send-email-spearce@spearce.org>
URL: https://gitlist.dev/e/1250105956-17795-1-git-send-email-spearce%40spearce.org

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

```

## Robin Rosenberg, 2009-08-12 20:37

Subject: Re: [JGIT PATCH] Rename RevTag.getName() to RevTag.getTagName()
Message-ID: <200908122237.37148.robin.rosenberg.lists@dewire.com>
URL: https://gitlist.dev/e/200908122237.37148.robin.rosenberg.lists%40dewire.com
In-Reply-To: <1250105956-17795-1-git-send-email-spearce@spearce.org>

```
onsdag 12 augusti 2009 21:39:16 skrev "Shawn O. Pearce" <spearce@spearce.org>:
> 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.

> @@ -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() {

You forgot the rename of the method here, and all uses of it.

-- robin

```

## Shawn O. Pearce, 2009-08-12 20:51

Subject: [JGIT PATCH v2] Rename RevTag.getName() to RevTag.getTagName()
Message-ID: <20090812205108.GI1033@spearce.org>
URL: https://gitlist.dev/e/20090812205108.GI1033%40spearce.org
In-Reply-To: <200908122237.37148.robin.rosenberg.lists@dewire.com>

```
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>
---
 Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
 > You forgot the rename of the method here, and all uses of it.

 Quite right.  #@*!! Eclipse.  I thought I refactored that method,
 but I guess it didn't actually do the work, and I failed to read
 the diff closely enough to notice.  *sigh* That's what I get for
 trying to quickly bang out a "simple" change.

 .../org/spearce/jgit/revwalk/RevTagParseTest.java  |    8 ++++----
 .../src/org/spearce/jgit/revwalk/RevTag.java       |   10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevTagParseTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevTagParseTest.java
index 66bc901..9f91154 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevTagParseTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/revwalk/RevTagParseTest.java
@@ -75,7 +75,7 @@ private void testOneType(final int typeCode) throws Exception {
 
 		c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
 		assertNull(c.getObject());
-		assertNull(c.getName());
+		assertNull(c.getTagName());
 
 		c.parseCanonical(rw, b.toString().getBytes("UTF-8"));
 		assertNotNull(c.getObject());
@@ -117,15 +117,15 @@ public void testParseAllFields() throws Exception {
 
 		c = new RevTag(id("9473095c4cb2f12aefe1db8a355fe3fafba42f67"));
 		assertNull(c.getObject());
-		assertNull(c.getName());
+		assertNull(c.getTagName());
 
 		c.parseCanonical(rw, body.toString().getBytes("UTF-8"));
 		assertNotNull(c.getObject());
 		assertEquals(treeId, c.getObject().getId());
 		assertSame(rw.lookupTree(treeId), c.getObject());
 
-		assertNotNull(c.getName());
-		assertEquals(name, c.getName());
+		assertNotNull(c.getTagName());
+		assertEquals(name, c.getTagName());
 		assertEquals("", c.getFullMessage());
 
 		final PersonIdent cTagger = c.getTaggerIdent();
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..204e9b1 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);
 	}
 
 	/**
@@ -203,8 +203,8 @@ public final RevObject getObject() {
 	 * 
 	 * @return name of the tag, according to the tag header.
 	 */
-	public final String getName() {
-		return name;
+	public final String getTagName() {
+		return tagName;
 	}
 
 	final void disposeBody() {
-- 
1.6.4.225.gb589e

```
