Browse Source

Remove getter and setter for author in Tag

There was a duplicated getter and setter for tagger in Tag.
There's no needed to have two getters and setters that represent
the same things. The appropriate tests were updated also.

Change-Id: If46dc00c4c0f31ea4234c6d3bda3c03e6ebbafac
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
stable-0.9
Chris Aniszczyk 14 years ago
parent
commit
6c9d82b4ce
  1. 19
      org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java
  2. 3
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java
  3. 19
      org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java

19
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/T0003_Basic.java

@ -2,6 +2,7 @@
* Copyright (C) 2007, Dave Watson <dwatson@mimvista.com> * Copyright (C) 2007, Dave Watson <dwatson@mimvista.com>
* Copyright (C) 2007-2010, Robin Rosenberg <robin.rosenberg@dewire.com> * Copyright (C) 2007-2010, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2006-2008, Shawn O. Pearce <spearce@spearce.org> * Copyright (C) 2006-2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2010, Chris Aniszczyk <caniszczyk@gmail.com>
* and other copyright owners as documented in the project's IP log. * and other copyright owners as documented in the project's IP log.
* *
* This program and the accompanying materials are made available * This program and the accompanying materials are made available
@ -432,7 +433,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
t.setObjId(emptyId); t.setObjId(emptyId);
t.setType("blob"); t.setType("blob");
t.setTag("test020"); t.setTag("test020");
t.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); t.setTagger(new PersonIdent(author, 1154236443000L, -4 * 60));
t.setMessage("test020 tagged\n"); t.setMessage("test020 tagged\n");
t.tag(); t.tag();
assertEquals("6759556b09fbb4fd8ae5e315134481cc25d46954", t.getTagId().name()); assertEquals("6759556b09fbb4fd8ae5e315134481cc25d46954", t.getTagId().name());
@ -440,7 +441,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
Tag mapTag = db.mapTag("test020"); Tag mapTag = db.mapTag("test020");
assertEquals("blob", mapTag.getType()); assertEquals("blob", mapTag.getType());
assertEquals("test020 tagged\n", mapTag.getMessage()); assertEquals("test020 tagged\n", mapTag.getMessage());
assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.getAuthor()); assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.getTagger());
assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag.getObjId().name()); assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag.getObjId().name());
} }
@ -466,7 +467,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
t.setObjId(almostEmptyTreeId); t.setObjId(almostEmptyTreeId);
t.setType("tree"); t.setType("tree");
t.setTag("test021"); t.setTag("test021");
t.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); t.setTagger(new PersonIdent(author, 1154236443000L, -4 * 60));
t.setMessage("test021 tagged\n"); t.setMessage("test021 tagged\n");
t.tag(); t.tag();
assertEquals("b0517bc8dbe2096b419d42424cd7030733f4abe5", t.getTagId().name()); assertEquals("b0517bc8dbe2096b419d42424cd7030733f4abe5", t.getTagId().name());
@ -474,7 +475,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
Tag mapTag = db.mapTag("test021"); Tag mapTag = db.mapTag("test021");
assertEquals("tree", mapTag.getType()); assertEquals("tree", mapTag.getType());
assertEquals("test021 tagged\n", mapTag.getMessage()); assertEquals("test021 tagged\n", mapTag.getMessage());
assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.getAuthor()); assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.getTagger());
assertEquals("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag.getObjId().name()); assertEquals("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag.getObjId().name());
} }
@ -493,7 +494,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
t.setObjId(almostEmptyCommitId); t.setObjId(almostEmptyCommitId);
t.setType("commit"); t.setType("commit");
t.setTag("test022"); t.setTag("test022");
t.setAuthor(new PersonIdent(author, 1154236443000L, -4 * 60)); t.setTagger(new PersonIdent(author, 1154236443000L, -4 * 60));
t.setMessage("test022 tagged\n"); t.setMessage("test022 tagged\n");
t.tag(); t.tag();
assertEquals("0ce2ebdb36076ef0b38adbe077a07d43b43e3807", t.getTagId().name()); assertEquals("0ce2ebdb36076ef0b38adbe077a07d43b43e3807", t.getTagId().name());
@ -501,7 +502,7 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
Tag mapTag = db.mapTag("test022"); Tag mapTag = db.mapTag("test022");
assertEquals("commit", mapTag.getType()); assertEquals("commit", mapTag.getType());
assertEquals("test022 tagged\n", mapTag.getMessage()); assertEquals("test022 tagged\n", mapTag.getMessage());
assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.getAuthor()); assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag.getTagger());
assertEquals("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag.getObjId().name()); assertEquals("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag.getObjId().name());
} }
@ -567,19 +568,19 @@ public class T0003_Basic extends SampleDataRepositoryTestCase {
assertNotNull("have tag test020", mapTag20); assertNotNull("have tag test020", mapTag20);
assertEquals("blob", mapTag20.getType()); assertEquals("blob", mapTag20.getType());
assertEquals("test020 tagged\n", mapTag20.getMessage()); assertEquals("test020 tagged\n", mapTag20.getMessage());
assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag20.getAuthor()); assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag20.getTagger());
assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag20.getObjId().name()); assertEquals("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", mapTag20.getObjId().name());
Tag mapTag21 = db.mapTag("test021"); Tag mapTag21 = db.mapTag("test021");
assertEquals("tree", mapTag21.getType()); assertEquals("tree", mapTag21.getType());
assertEquals("test021 tagged\n", mapTag21.getMessage()); assertEquals("test021 tagged\n", mapTag21.getMessage());
assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag21.getAuthor()); assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag21.getTagger());
assertEquals("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag21.getObjId().name()); assertEquals("417c01c8795a35b8e835113a85a5c0c1c77f67fb", mapTag21.getObjId().name());
Tag mapTag22 = db.mapTag("test022"); Tag mapTag22 = db.mapTag("test022");
assertEquals("commit", mapTag22.getType()); assertEquals("commit", mapTag22.getType());
assertEquals("test022 tagged\n", mapTag22.getMessage()); assertEquals("test022 tagged\n", mapTag22.getMessage());
assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag22.getAuthor()); assertEquals(new PersonIdent(author, 1154236443000L, -4 * 60), mapTag22.getTagger());
assertEquals("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag22.getObjId().name()); assertEquals("b5d3b45a96b340441f5abb9080411705c51cc86c", mapTag22.getObjId().name());
} }

3
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectInserter.java

@ -2,6 +2,7 @@
* Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com> * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2009, Google Inc. * Copyright (C) 2009, Google Inc.
* Copyright (C) 2010, Chris Aniszczyk <caniszczyk@gmail.com>
* and other copyright owners as documented in the project's IP log. * and other copyright owners as documented in the project's IP log.
* *
* This program and the accompanying materials are made available * This program and the accompanying materials are made available
@ -378,7 +379,7 @@ public abstract class ObjectInserter {
w.write("\n"); w.write("\n");
w.write("tagger "); w.write("tagger ");
w.write(tag.getAuthor().toExternalString()); w.write(tag.getTagger().toExternalString());
w.write('\n'); w.write('\n');
w.write('\n'); w.write('\n');

19
org.eclipse.jgit/src/org/eclipse/jgit/lib/Tag.java

@ -1,6 +1,7 @@
/* /*
* Copyright (C) 2006-2008, Robin Rosenberg <robin.rosenberg@dewire.com> * Copyright (C) 2006-2008, Robin Rosenberg <robin.rosenberg@dewire.com>
* Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
* Copyright (C) 2010, Chris Aniszczyk <caniszczyk@gmail.com>
* and other copyright owners as documented in the project's IP log. * and other copyright owners as documented in the project's IP log.
* *
* This program and the accompanying materials are made available * This program and the accompanying materials are made available
@ -105,22 +106,6 @@ public class Tag {
this.raw = raw; this.raw = raw;
} }
/**
* @return tagger of a annotated tag or null
*/
public PersonIdent getAuthor() {
decode();
return tagger;
}
/**
* Set author of an annotated tag.
* @param a author identifier as a {@link PersonIdent}
*/
public void setAuthor(final PersonIdent a) {
tagger = a;
}
/** /**
* @return comment of an annotated tag, or null * @return comment of an annotated tag, or null
*/ */
@ -223,7 +208,7 @@ public class Tag {
} }
public String toString() { public String toString() {
return "tag[" + getTag() + getType() + getObjId() + " " + getAuthor() + "]"; return "tag[" + getTag() + getType() + getObjId() + " " + getTagger() + "]";
} }
/** /**

Loading…
Cancel
Save