mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 18:51:10 +01:00
Bugfix for long filenames in tar (#1552)
Fixes errors with long file names in tar archives. This may arise with hg repositories with deep directories.
This commit is contained in:
@@ -34,6 +34,7 @@ import sonia.scm.repository.api.ExportFailedException;
|
||||
import sonia.scm.repository.api.RepositoryService;
|
||||
import sonia.scm.repository.api.RepositoryServiceFactory;
|
||||
import sonia.scm.repository.work.WorkdirProvider;
|
||||
import sonia.scm.util.Archives;
|
||||
import sonia.scm.util.IOUtil;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -84,7 +85,7 @@ public class FullScmRepositoryExporter {
|
||||
RepositoryService service = serviceFactory.create(repository);
|
||||
BufferedOutputStream bos = new BufferedOutputStream(outputStream);
|
||||
GzipCompressorOutputStream gzos = new GzipCompressorOutputStream(bos);
|
||||
TarArchiveOutputStream taos = new TarArchiveOutputStream(gzos)
|
||||
TarArchiveOutputStream taos = Archives.createTarOutputStream(gzos)
|
||||
) {
|
||||
writeEnvironmentData(taos);
|
||||
writeMetadata(repository, taos);
|
||||
|
||||
@@ -40,6 +40,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import static java.util.Arrays.stream;
|
||||
import static sonia.scm.util.Archives.createTarInputStream;
|
||||
|
||||
public class FullScmRepositoryImporter {
|
||||
|
||||
@@ -65,7 +66,7 @@ public class FullScmRepositoryImporter {
|
||||
try (
|
||||
BufferedInputStream bif = new BufferedInputStream(inputStream);
|
||||
GzipCompressorInputStream gcis = new GzipCompressorInputStream(bif);
|
||||
TarArchiveInputStream tais = new TarArchiveInputStream(gcis)
|
||||
TarArchiveInputStream tais = createTarInputStream(gcis)
|
||||
) {
|
||||
return run(repository, tais);
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ import sonia.scm.store.ExportableStore;
|
||||
import sonia.scm.store.StoreEntryMetaData;
|
||||
import sonia.scm.store.StoreExporter;
|
||||
import sonia.scm.store.StoreType;
|
||||
import sonia.scm.util.Archives;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.FilterOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@@ -58,8 +58,7 @@ public class TarArchiveRepositoryStoreExporter {
|
||||
|
||||
public void export(Repository repository, OutputStream output) {
|
||||
try (
|
||||
BufferedOutputStream bos = new BufferedOutputStream(output);
|
||||
final TarArchiveOutputStream taos = new TarArchiveOutputStream(bos)
|
||||
final TarArchiveOutputStream taos = Archives.createTarOutputStream(output)
|
||||
) {
|
||||
List<ExportableStore> exportableStores = storeExporter.listExportableStores(repository);
|
||||
for (ExportableStore store : exportableStores) {
|
||||
|
||||
Reference in New Issue
Block a user