Merge "Add javadoc for old commit IDs of file diffs against a root commit"
diff --git a/java/com/google/gerrit/server/patch/filediff/FileDiffOutput.java b/java/com/google/gerrit/server/patch/filediff/FileDiffOutput.java
index 76f6eb7..242c1a4 100644
--- a/java/com/google/gerrit/server/patch/filediff/FileDiffOutput.java
+++ b/java/com/google/gerrit/server/patch/filediff/FileDiffOutput.java
@@ -37,7 +37,10 @@
public abstract class FileDiffOutput implements Serializable {
private static final long serialVersionUID = 1L;
- /** The 20 bytes SHA-1 object ID of the old git commit used in the diff. */
+ /**
+ * The 20 bytes SHA-1 object ID of the old git commit used in the diff, or {@link
+ * ObjectId#zeroId()} if {@link #newCommitId()} was a root commit.
+ */
public abstract ObjectId oldCommitId();
/** The 20 bytes SHA-1 object ID of the new git commit used in the diff. */
diff --git a/java/com/google/gerrit/server/patch/gitfilediff/GitFileDiff.java b/java/com/google/gerrit/server/patch/gitfilediff/GitFileDiff.java
index a502a46..2f23c8c 100644
--- a/java/com/google/gerrit/server/patch/gitfilediff/GitFileDiff.java
+++ b/java/com/google/gerrit/server/patch/gitfilediff/GitFileDiff.java
@@ -34,6 +34,7 @@
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.lib.AbbreviatedObjectId;
import org.eclipse.jgit.lib.FileMode;
+import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.patch.FileHeader;
/**
@@ -120,7 +121,10 @@
/** The file name at the new git tree identified by {@link #newId()} */
public abstract Optional<String> newPath();
- /** The 20 bytes SHA-1 object ID of the old git tree of the diff. */
+ /**
+ * The 20 bytes SHA-1 object ID of the old git tree of the diff, or {@link ObjectId#zeroId()} if
+ * {@link #newId()} was a root git tree (i.e. has no parents).
+ */
public abstract AbbreviatedObjectId oldId();
/** The 20 bytes SHA-1 object ID of the new git tree of the diff. */