diff options
author | David Pursehouse <dpursehouse@collab.net> | 2019-02-21 14:12:40 +0900 |
---|---|---|
committer | David Pursehouse <dpursehouse@collab.net> | 2019-02-26 17:27:10 +0900 |
commit | 5c25c0400415ef7e59adf4c21b52920e7b81cefe (patch) | |
tree | c48a6931297c9bb9215f8059df26d1ecc350ac77 | |
parent | 0b3d333ca62f8bd6da5f3990666d9032431bdea2 (diff) |
MergeUtil: Include project name in "Reviewed-On" URL
The method UrlFormatter#getChangeViewUrl has the @Nullable annotation
on the project argument, allowing the project name to be omitted from
the URL.
The URL used in the Reviewed-On footer, which is added to the detailed
commit message, is the only place that passes null for that parameter,
and as a result this is the only place in Gerrit where the change URL
does not include the project name.
Bug: Issue 10512
Change-Id: Ib6737af0a72adb7706caa20991780be71617dd24
-rw-r--r-- | java/com/google/gerrit/server/git/MergeUtil.java | 2 | ||||
-rw-r--r-- | javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java | 14 |
2 files changed, 13 insertions, 3 deletions
diff --git a/java/com/google/gerrit/server/git/MergeUtil.java b/java/com/google/gerrit/server/git/MergeUtil.java index 5b09fc7ead..50eaa5dc3d 100644 --- a/java/com/google/gerrit/server/git/MergeUtil.java +++ b/java/com/google/gerrit/server/git/MergeUtil.java @@ -492,7 +492,7 @@ public class MergeUtil { msgbuf.append('\n'); } - Optional<String> url = urlFormatter.get().getChangeViewUrl(null, c.getId()); + Optional<String> url = urlFormatter.get().getChangeViewUrl(c.getProject(), c.getId()); if (url.isPresent()) { if (!contains(footers, FooterConstants.REVIEWED_ON, url.get())) { msgbuf diff --git a/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java b/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java index 9deb927e75..3ffec94417 100644 --- a/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java +++ b/javatests/com/google/gerrit/acceptance/api/change/ChangeIT.java @@ -2698,7 +2698,12 @@ public class ChangeIT extends AbstractDaemonTest { List<String> expectedFooters = Arrays.asList( "Change-Id: " + r2.getChangeId(), - "Reviewed-on: " + canonicalWebUrl.get() + "c/" + r2.getChange().getId(), + "Reviewed-on: " + + canonicalWebUrl.get() + + "c/" + + project.get() + + "/+/" + + r2.getChange().getId(), "Reviewed-by: Administrator <admin@example.com>", "Custom2: Administrator <admin@example.com>", "Tested-by: Administrator <admin@example.com>"); @@ -2740,7 +2745,12 @@ public class ChangeIT extends AbstractDaemonTest { List<String> expectedFooters = Arrays.asList( "Change-Id: " + change.getChangeId(), - "Reviewed-on: " + canonicalWebUrl.get() + "c/" + change.getChange().getId(), + "Reviewed-on: " + + canonicalWebUrl.get() + + "c/" + + project.get() + + "/+/" + + change.getChange().getId(), "Custom: refs/heads/master"); assertThat(footers).containsExactlyElementsIn(expectedFooters); } |