Set CommitInfo.commit in ChangeJson#toCommit

Change-Id: I285f767aafa1fa437cb96640ff90d55799ea46f9
This commit is contained in:
Yuxuan 'fishy' Wang
2016-07-11 15:41:12 -07:00
parent 025e65d7d5
commit 67608c2d98
2 changed files with 42 additions and 30 deletions

View File

@@ -389,6 +389,7 @@ default. Optional fields are:
}
},
"commit": {
"commit": "184ebe53805e102605d11f6b143486d15c23a09c",
"parents": [
{
"commit": "1eee2c9d8f352483781e772f35dc586a69ff5646",
@@ -947,6 +948,7 @@ is included.
}
},
"commit": {
"commit": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
"parents": [
{
"commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
@@ -970,6 +972,7 @@ is included.
}
}
}
}
----
If the change cannot be rebased, e.g. due to conflicts, the response is
@@ -1325,6 +1328,7 @@ link:#current-commit[\{CURRENT_COMMIT\}] set.
"ref": "refs/changes/79/1779/1",
"fetch": {},
"commit": {
"commit": "9adb9f4c7b40eeee0646e235de818d09164d7379",
"parents": [
{
"commit": "2d3176497a2747faed075f163707e57d9f961a1c",
@@ -1444,6 +1448,7 @@ link:#current-commit[\{CURRENT_COMMIT\}] set.
"ref": "refs/changes/80/1780/1",
"fetch": {},
"commit": {
"commit": "1bd7c12a38854a2c6de426feec28800623f492c4",
"parents": [
{
"commit": "9adb9f4c7b40eeee0646e235de818d09164d7379",
@@ -2879,6 +2884,7 @@ is included.
}
},
"commit": {
"commit": "27cc4558b5a3d3387dd11ee2df7a117e7e581822",
"parents": [
{
"commit": "b4003890dadd406d80222bf1ad8aca09a4876b70",
@@ -2902,6 +2908,7 @@ is included.
}
}
}
}
----
If the revision cannot be rebased, e.g. due to conflicts, the response is

View File

@@ -1013,6 +1013,11 @@ public class ChangeJson {
boolean addLinks) throws IOException {
Project.NameKey project = ctl.getProject().getNameKey();
CommitInfo info = new CommitInfo();
// TODO(fishywang): this is redundant with the map key, find a better way to provide the SHA-1
// for RevisionEvent.
info.commit = commit.name();
info.parents = new ArrayList<>(commit.getParentCount());
info.author = toGitPerson(commit.getAuthorIdent());
info.committer = toGitPerson(commit.getCommitterIdent());