diff --git a/Documentation/rest-api-projects.txt b/Documentation/rest-api-projects.txt index a909ab4c44..45d33aef34 100644 --- a/Documentation/rest-api-projects.txt +++ b/Documentation/rest-api-projects.txt @@ -2329,7 +2329,7 @@ points. For annotated tags, the revision of the tag object. tag points. |`message`|Only set for annotated tags.|The tag message. For signed tags, includes the signature. -|`tagger`|Only set for annotated tags.|The tagger as a +|`tagger`|Only set for annotated tags, if present in the tag.|The tagger as a link:rest-api-changes.html#git-person-info[GitPersonInfo] entity. |========================= diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ListTags.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ListTags.java index 3b1232b7d7..1a359c1f11 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ListTags.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ListTags.java @@ -34,6 +34,7 @@ import com.google.inject.Singleton; import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.errors.RepositoryNotFoundException; import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevObject; @@ -132,14 +133,16 @@ public class ListTags implements RestReadView { throws MissingObjectException, IOException { RevObject object = rw.parseAny(ref.getObjectId()); if (object instanceof RevTag) { - RevTag tag = (RevTag)object; // Annotated or signed tag + RevTag tag = (RevTag)object; + PersonIdent tagger = tag.getTaggerIdent(); return new TagInfo( ref.getName(), tag.getName(), tag.getObject().getName(), tag.getFullMessage().trim(), - CommonConverters.toGitPerson(tag.getTaggerIdent())); + tagger != null ? + CommonConverters.toGitPerson(tag.getTaggerIdent()) : null); } else { // Lightweight tag return new TagInfo(