Fix broken tar.xz archive download Gitiles advertises the tar.xz archive format (ArchiveFormat.TXZ), but the generated gitiles.war did not package org.tukaani.xz. JGit's Bazel jgit-archive target failed to declare it (the //lib:xz target was testonly), so it was never pulled transitively. Requesting a .tar.xz archive therefore failed at runtime with NoClassDefFoundError: org/tukaani/xz/..., and no test caught it because the only archive test exercised tar.gz. Bump the JGit submodule to pick up the fix that declares org.tukaani.xz as a dependency of the archive library, and add a regression test that streams a .tar.xz archive. Depends-On: https://eclipse.gerrithub.io/c/eclipse-jgit/jgit/+/1247298 Change-Id: I1cd020dc4c4d0e3059d7f3b57ac2771f6037c50d
diff --git a/javatests/com/google/gitiles/ArchiveServletTest.java b/javatests/com/google/gitiles/ArchiveServletTest.java index 8d7bc4c..e5e8c08 100644 --- a/javatests/com/google/gitiles/ArchiveServletTest.java +++ b/javatests/com/google/gitiles/ArchiveServletTest.java
@@ -55,4 +55,24 @@ byte[] body = res.getActualBody(); assertThat(body.length).isGreaterThan(20); } + + @Test + public void tarXzArchive_regressionForMissingXzDependency() throws Exception { + repo.branch("master").commit().add("README.md", "hello\n").create(); + + FakeHttpServletResponse res = + buildResponse("/repo/+archive/refs/heads/master.tar.xz", /* queryString= */ null, SC_OK); + + String contentType = res.getHeader(HttpHeaders.CONTENT_TYPE); + assertThat(contentType).isNotNull(); + assertThat(contentType.toLowerCase()).contains("xz"); + + String cd = res.getHeader(HttpHeaders.CONTENT_DISPOSITION); + assertThat(cd).isNotNull(); + assertThat(cd).contains("attachment"); + assertThat(cd).contains(".tar.xz"); + + byte[] body = res.getActualBody(); + assertThat(body.length).isGreaterThan(20); + } }
diff --git a/modules/jgit b/modules/jgit index fe01de6..2bf2e4a 160000 --- a/modules/jgit +++ b/modules/jgit
@@ -1 +1 @@ -Subproject commit fe01de69f44611049b664188652bf9e340f0b1f8 +Subproject commit 2bf2e4a32ef9347617a73ae739d08fc48c029989