mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-10-30 01:55:58 +01:00
Add git-lfs support
This commit is contained in:
@@ -53,6 +53,12 @@ public class GitUserAgentProvider implements UserAgentProvider
|
||||
false).basicAuthenticationCharset(
|
||||
Charsets.UTF_8).build();
|
||||
|
||||
@VisibleForTesting
|
||||
static final UserAgent GIT_LFS = UserAgent.builder("Git Lfs")
|
||||
.browser(false)
|
||||
.basicAuthenticationCharset(Charsets.UTF_8)
|
||||
.build();
|
||||
|
||||
/** Field description */
|
||||
@VisibleForTesting
|
||||
static final UserAgent MSYSGIT = UserAgent.builder("msysGit").browser(
|
||||
@@ -60,10 +66,11 @@ public class GitUserAgentProvider implements UserAgentProvider
|
||||
Charsets.UTF_8).build();
|
||||
|
||||
/** Field description */
|
||||
private static final String PREFIX = "git/";
|
||||
private static final String PREFIX_REGULAR = "git/";
|
||||
private static final String PREFIX_LFS = "git-lfs/";
|
||||
|
||||
/** Field description */
|
||||
private static final String SUFFIX = "msysgit";
|
||||
private static final String SUFFIX_MSYSGIT = "msysgit";
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
@@ -80,16 +87,14 @@ public class GitUserAgentProvider implements UserAgentProvider
|
||||
{
|
||||
UserAgent ua = null;
|
||||
|
||||
if (userAgentString.startsWith(PREFIX))
|
||||
{
|
||||
if (userAgentString.contains(SUFFIX))
|
||||
{
|
||||
if (userAgentString.startsWith(PREFIX_REGULAR)) {
|
||||
if (userAgentString.contains(SUFFIX_MSYSGIT)) {
|
||||
ua = MSYSGIT;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ua = GIT;
|
||||
}
|
||||
} else if (userAgentString.startsWith(PREFIX_LFS)) {
|
||||
ua = GIT_LFS;
|
||||
}
|
||||
|
||||
return ua;
|
||||
|
||||
Reference in New Issue
Block a user