Set path to null for archive link of root tree Prior to this change, the archive link for the root tree was of the form "revision/.ext"; this makes it "revision.ext", meaning the archive of the root tree is identical to (the same URL and therefore contents as) the archive of the commit. Change-Id: Ied963a6ecb8c5c8b054c18b1f76e59d980c24938
diff --git a/gitiles-servlet/src/main/java/com/google/gitiles/TreeSoyData.java b/gitiles-servlet/src/main/java/com/google/gitiles/TreeSoyData.java index b7a9b28..0a828c2 100644 --- a/gitiles-servlet/src/main/java/com/google/gitiles/TreeSoyData.java +++ b/gitiles-servlet/src/main/java/com/google/gitiles/TreeSoyData.java
@@ -18,6 +18,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Charsets; +import com.google.common.base.Strings; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.gitiles.PathServlet.FileType; @@ -134,6 +135,7 @@ data.put("logUrl", GitilesView.log().copyFrom(view).toUrl()); data.put("archiveUrl", GitilesView.archive() .copyFrom(view) + .setPathPart(Strings.emptyToNull(view.getPathPart())) .setExtension(archiveFormat.getDefaultSuffix()) .toUrl()); data.put("archiveType", archiveFormat.getShortName());