Source:
public void testInitialClone_RedirectOnPostAllowed() throws Exception { FileBasedConfig userConfig = SystemReader.getInstance() .openUserConfig(null, FS.DETECTED); userConfig.setString("http", null, "followRedirects", "true"); userConfig.save(); Repository dst = createBareRepository(); assertFalse(dst.hasObject(A_txt)); String remoteUri = remoteURI.toString(); int i = remoteUri.lastIndexOf('/'); remoteUri = remoteUri.substring(0, i) + "/post" + remoteUri.substring(i); URIish cloneFrom = new URIish(remoteUri); try (Transport t = Transport.open(dst, cloneFrom)) { t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); } assertTrue(dst.hasObject(A_txt)); assertEquals(B, dst.exactRef(master).getObjectId()); fsck(dst, B); List<AccessEvent> requests = getRequests(); assertEquals(3, requests.size()); AccessEvent info = requests.get(0); assertEquals("GET", info.getMethod()); assertEquals(join(cloneFrom, "info/refs"), info.getPath()); assertEquals(1, info.getParameters().size()); assertEquals("git-upload-pack", info.getParameter("service")); assertEquals(200, info.getStatus()); assertEquals("application/x-git-upload-pack-advertisement", info.getResponseHeader(HDR_CONTENT_TYPE)); assertEquals("gzip", info.getResponseHeader(HDR_CONTENT_ENCODING)); AccessEvent redirect = requests.get(1); assertEquals(301, redirect.getStatus()); AccessEvent service = requests.get(2); assertEquals("POST", service.getMethod()); assertEquals(join(remoteURI, "git-upload-pack"), service.getPath()); assertEquals(0, service.getParameters().size()); assertNotNull("has content-length", service.getRequestHeader(HDR_CONTENT_LENGTH)); assertNull("not chunked", service.getRequestHeader(HDR_TRANSFER_ENCODING)); assertEquals(200, service.getStatus()); assertEquals("application/x-git-upload-pack-result", service.getResponseHeader(HDR_CONTENT_TYPE)); }

Target:
public void testInitialClone_RedirectOnPostAllowed() throws Exception { FileBasedConfig userConfig = SystemReader.getInstance() .openUserConfig(null, FS.DETECTED); userConfig.setString("http", null, "followRedirects", "true"); userConfig.save(); Repository dst = createBareRepository(); assertFalse(dst.hasObject(A_txt)); String remoteUri = remoteURI.toString(); int i = remoteUri.lastIndexOf('/'); remoteUri = remoteUri.substring(0, i) + "/post" + remoteUri.substring(i); URIish cloneFrom = new URIish(remoteUri); try (Transport t = Transport.open(dst, cloneFrom)) { t.fetch(NullProgressMonitor.INSTANCE, mirror(master)); } assertTrue(dst.hasObject(A_txt)); assertEquals(B, dst.exactRef(master).getObjectId()); fsck(dst, B); List<AccessEvent> requests = getRequests(); assertEquals(3, requests.size()); AccessEvent info = requests.get(0); assertEquals("GET", info.getMethod()); assertEquals(join(cloneFrom, "info/refs"), info.getPath()); assertEquals(1, info.getParameters().size()); assertEquals("git-upload-pack", info.getParameter("service")); assertEquals(200, info.getStatus()); assertEquals("application/x-git-upload-pack-advertisement", info.getResponseHeader(HDR_CONTENT_TYPE)); assertEquals("gzip", info.getResponseHeader(HDR_CONTENT_ENCODING)); AccessEvent redirect = requests.get(1); assertEquals("POST", redirect.getMethod()); assertEquals(301, redirect.getStatus()); AccessEvent service = requests.get(2); assertEquals("POST", service.getMethod()); assertEquals(join(remoteURI, "git-upload-pack"), service.getPath()); assertEquals(0, service.getParameters().size()); assertNotNull("has content-length", service.getRequestHeader(HDR_CONTENT_LENGTH)); assertNull("not chunked", service.getRequestHeader(HDR_TRANSFER_ENCODING)); assertEquals(200, service.getStatus()); assertEquals("application/x-git-upload-pack-result", service.getResponseHeader(HDR_CONTENT_TYPE)); }