diff options
author | James Moger <james.moger@gitblit.com> | 2014-06-05 14:14:54 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-06-05 14:16:42 -0400 |
commit | 1b04d7730f56a08c935974504b2d849d01870c02 (patch) | |
tree | e6e18f88ed99c825f58f0cfaceb7123aec75dba7 /src/main/java/com/gitblit/GitBlit.java | |
parent | 6551f2c076fd5b4a836bdc9bd3e09205b0673472 (diff) | |
download | gitblit-1b04d7730f56a08c935974504b2d849d01870c02.tar.gz gitblit-1b04d7730f56a08c935974504b2d849d01870c02.zip |
Add clone transport user preference
Diffstat (limited to 'src/main/java/com/gitblit/GitBlit.java')
-rw-r--r-- | src/main/java/com/gitblit/GitBlit.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/com/gitblit/GitBlit.java b/src/main/java/com/gitblit/GitBlit.java index 81793850..f9d9be9f 100644 --- a/src/main/java/com/gitblit/GitBlit.java +++ b/src/main/java/com/gitblit/GitBlit.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Set; @@ -264,6 +265,24 @@ public class GitBlit extends GitblitManager { } }); + // consider the user's transport preference + RepositoryUrl preferredUrl = null; + Transport preferredTransport = user.getPreferences().getTransport(); + if (preferredTransport != null) { + Iterator<RepositoryUrl> itr = list.iterator(); + while (itr.hasNext()) { + RepositoryUrl url = itr.next(); + if (url.transport.equals(preferredTransport)) { + itr.remove(); + preferredUrl = url; + break; + } + } + } + if (preferredUrl != null) { + list.add(0, preferredUrl); + } + return list; } |