diff --git a/CHANGELOG.md b/CHANGELOG.md index b24b4e6351..66b281b407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.46.6] - 2025-08-19 +### Fixed +- Support for go-git user agents (e.g. ArgoCD ≥ 2.14) + ## [3.7.5] - 2025-04-14 ### Fixed - Fix setting of document title for create repository page, if only a translation key was provided @@ -1688,6 +1692,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [2.46.3]: https://scm-manager.org/download/2.46.3 [2.46.4]: https://scm-manager.org/download/2.46.4 [2.46.5]: https://scm-manager.org/download/2.46.5 +[2.46.6]: https://scm-manager.org/download/2.46.6 [2.47.0]: https://scm-manager.org/download/2.47.0 [2.48.0]: https://scm-manager.org/download/2.48.0 [2.48.1]: https://scm-manager.org/download/2.48.1 diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitUserAgentProvider.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitUserAgentProvider.java index ce6395516e..41acbf88ee 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitUserAgentProvider.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/web/GitUserAgentProvider.java @@ -59,7 +59,12 @@ public class GitUserAgentProvider implements UserAgentProvider { .basicAuthenticationCharset(Charsets.UTF_8) .build(); + private static final String PREFIX_GOGIT = "go-git/"; + @VisibleForTesting + static final UserAgent GOGIT = UserAgent.scmClient("go-git") + .basicAuthenticationCharset(Charsets.UTF_8) + .build(); @Override @@ -74,6 +79,8 @@ public class GitUserAgentProvider implements UserAgentProvider { return GIT_LFS; } else if (isGit(lowerUserAgent)) { return GIT; + } else if (isGoGit(lowerUserAgent)) { + return GOGIT; } else { return null; } @@ -98,4 +105,6 @@ public class GitUserAgentProvider implements UserAgentProvider { private boolean isGit(String userAgent) { return userAgent.startsWith(PREFIX_REGULAR); } + + private boolean isGoGit(String userAgent) { return userAgent.startsWith(PREFIX_GOGIT); } } diff --git a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/web/GitUserAgentProviderTest.java b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/web/GitUserAgentProviderTest.java index cd33a4322f..282a12e75c 100644 --- a/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/web/GitUserAgentProviderTest.java +++ b/scm-plugins/scm-git-plugin/src/test/java/sonia/scm/web/GitUserAgentProviderTest.java @@ -36,6 +36,7 @@ public class GitUserAgentProviderTest { assertEquals(GitUserAgentProvider.JGIT, parse("jgit/4.5.2")); assertEquals(GitUserAgentProvider.GIT_LFS, parse("git-lfs/2.0.1 (GitHub; windows amd64; go 1.8; git 678cdbd4)")); assertEquals(GitUserAgentProvider.MSYSGIT, parse("git/1.8.3.msysgit.0")); + assertEquals(GitUserAgentProvider.GOGIT, parse("go-git/5.x")); assertNull(parse("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36")); }