diff --git a/CHANGELOG.md b/CHANGELOG.md index 4671bed820..846f828329 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Change `myCloudogu` to new brand name `cloudogu platform` - Use Java 17 for Docker containers +## [2.44.3] - 2023-08-31 +### Fixed +- Loading LFS files for imports and mirrors +- Handling of submodules in imports and mirrors + ## [2.44.2] - 2023-06-23 ### Fixed - Internal server error with external groups in permission overview @@ -1355,6 +1360,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [2.44.0]: https://scm-manager.org/download/2.44.0 [2.44.1]: https://scm-manager.org/download/2.44.1 [2.44.2]: https://scm-manager.org/download/2.44.2 -[2.45.0]: https://scm-manager.org/download/2.45.0 -[2.45.1]: https://scm-manager.org/download/2.45.1 -[2.46.0]: https://scm-manager.org/download/2.46.0 diff --git a/scm-plugins/scm-git-plugin/package.json b/scm-plugins/scm-git-plugin/package.json index b178f1b28b..2ddb49a37f 100644 --- a/scm-plugins/scm-git-plugin/package.json +++ b/scm-plugins/scm-git-plugin/package.json @@ -33,4 +33,4 @@ "eslintConfig": { "extends": "@scm-manager/eslint-config" } -} \ No newline at end of file +} diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/LfsLoader.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/LfsLoader.java index d023c0cf27..088bf23dfd 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/LfsLoader.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/LfsLoader.java @@ -24,6 +24,7 @@ package sonia.scm.repository.spi; +import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.lfs.Lfs; import org.eclipse.jgit.lfs.LfsPointer; import org.eclipse.jgit.lfs.Protocol; @@ -32,6 +33,7 @@ import org.eclipse.jgit.lfs.lib.AnyLongObjectId; import org.eclipse.jgit.lfs.lib.LfsPointerFilter; import org.eclipse.jgit.lib.ConfigConstants; import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; @@ -85,7 +87,8 @@ class LfsLoader { .setString(ConfigConstants.CONFIG_SECTION_LFS, null, ConfigConstants.CONFIG_KEY_URL, computeLfsUrl(sourceUrl)); TreeWalk treeWalk = new TreeWalk(gitRepository); - treeWalk.setFilter(new LfsPointerFilter()); + treeWalk.setFilter(new ScmLfsPointerFilter()); + treeWalk.setRecursive(true); RevWalk revWalk = new RevWalk(gitRepository); revWalk.markStart(revWalk.parseCommit(newObjectId)); @@ -184,4 +187,24 @@ class LfsLoader { void loading(String name); } + + /** + * Fixes a bug in {@link org.eclipse.jgit.lfs.lib.LfsPointerFilter} for repositories containing submodules. + * These result in a {@link MissingObjectException} when the original class is used, because the filter tries + * to load the sha hash for the submodule as a simple file. To prevent this, this extension overrides + * {@link #include(TreeWalk)} and checks first, whether the walk points to a regular file before proceeding + * with the original implemantation. + * + * In later implementations this fix should be implemented in JGit directly. This subclass can then be removed. + */ + private static class ScmLfsPointerFilter extends LfsPointerFilter { + + @Override + public boolean include(TreeWalk walk) throws IOException { + if (walk.getFileMode().equals(FileMode.GITLINK)) { + return false; + } + return super.include(walk); + } + } } diff --git a/scm-plugins/scm-hg-plugin/package.json b/scm-plugins/scm-hg-plugin/package.json index cab7fb166e..5c9baaba86 100644 --- a/scm-plugins/scm-hg-plugin/package.json +++ b/scm-plugins/scm-hg-plugin/package.json @@ -32,4 +32,4 @@ "eslintConfig": { "extends": "@scm-manager/eslint-config" } -} \ No newline at end of file +} diff --git a/scm-plugins/scm-legacy-plugin/package.json b/scm-plugins/scm-legacy-plugin/package.json index 7d8ad70136..4821f92824 100644 --- a/scm-plugins/scm-legacy-plugin/package.json +++ b/scm-plugins/scm-legacy-plugin/package.json @@ -32,4 +32,4 @@ "eslintConfig": { "extends": "@scm-manager/eslint-config" } -} \ No newline at end of file +} diff --git a/scm-plugins/scm-svn-plugin/package.json b/scm-plugins/scm-svn-plugin/package.json index 3416732620..fe089565bb 100644 --- a/scm-plugins/scm-svn-plugin/package.json +++ b/scm-plugins/scm-svn-plugin/package.json @@ -32,4 +32,4 @@ "eslintConfig": { "extends": "@scm-manager/eslint-config" } -} \ No newline at end of file +} diff --git a/scm-ui/e2e-tests/package.json b/scm-ui/e2e-tests/package.json index 07d3cca50e..ea7ef68832 100644 --- a/scm-ui/e2e-tests/package.json +++ b/scm-ui/e2e-tests/package.json @@ -26,4 +26,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/scm-ui/ui-api/package.json b/scm-ui/ui-api/package.json index 2d31c237a9..3ef90deb7f 100644 --- a/scm-ui/ui-api/package.json +++ b/scm-ui/ui-api/package.json @@ -53,4 +53,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/scm-ui/ui-buttons/package.json b/scm-ui/ui-buttons/package.json index 723ebaa113..05c4f9db50 100644 --- a/scm-ui/ui-buttons/package.json +++ b/scm-ui/ui-buttons/package.json @@ -81,4 +81,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +}