summaryrefslogtreecommitdiffstats
path: root/src/main/java/com
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-05-07 09:59:41 -0400
committerJames Moger <james.moger@gitblit.com>2014-05-07 09:59:41 -0400
commite7bb5589b18b2bd176ef0cd152e0737c2f5dfa4c (patch)
treec9e9618c40835ff33fadcab589d8248a31d4d656 /src/main/java/com
parent337e2a0406d56b0b05012eb8e3bc1a393502f714 (diff)
parent4a275239523965a3c8f6cbf0a1c8529fce58806d (diff)
downloadgitblit-e7bb5589b18b2bd176ef0cd152e0737c2f5dfa4c.tar.gz
gitblit-e7bb5589b18b2bd176ef0cd152e0737c2f5dfa4c.zip
Merge branch 'ticket/62' into develop
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/gitblit/manager/RepositoryManager.java31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/main/java/com/gitblit/manager/RepositoryManager.java b/src/main/java/com/gitblit/manager/RepositoryManager.java
index 05a90b67..a76787bb 100644
--- a/src/main/java/com/gitblit/manager/RepositoryManager.java
+++ b/src/main/java/com/gitblit/manager/RepositoryManager.java
@@ -421,8 +421,9 @@ public class RepositoryManager implements IRepositoryManager {
// update the fork origin repository with this repository clone
if (!StringUtils.isEmpty(model.originRepository)) {
- if (repositoryListCache.containsKey(model.originRepository)) {
- RepositoryModel origin = repositoryListCache.get(model.originRepository);
+ String originKey = model.originRepository.toLowerCase();
+ if (repositoryListCache.containsKey(originKey)) {
+ RepositoryModel origin = repositoryListCache.get(originKey);
origin.addFork(model.name);
}
}
@@ -534,8 +535,9 @@ public class RepositoryManager implements IRepositoryManager {
// rebuild fork networks
for (RepositoryModel model : repositoryListCache.values()) {
if (!StringUtils.isEmpty(model.originRepository)) {
- if (repositoryListCache.containsKey(model.originRepository)) {
- RepositoryModel origin = repositoryListCache.get(model.originRepository);
+ String originKey = model.originRepository.toLowerCase();
+ if (repositoryListCache.containsKey(originKey)) {
+ RepositoryModel origin = repositoryListCache.get(originKey);
origin.addFork(model.name);
}
}
@@ -943,26 +945,31 @@ public class RepositoryManager implements IRepositoryManager {
*/
@Override
public String getFork(String username, String origin) {
+ if (StringUtils.isEmpty(origin)) {
+ return null;
+ }
String userProject = ModelUtils.getPersonalPath(username);
if (settings.getBoolean(Keys.git.cacheRepositoryList, true)) {
+ String originKey = origin.toLowerCase();
String userPath = userProject + "/";
// collect all origin nodes in fork network
Set<String> roots = new HashSet<String>();
- roots.add(origin);
- RepositoryModel originModel = repositoryListCache.get(origin);
+ roots.add(originKey);
+ RepositoryModel originModel = repositoryListCache.get(originKey);
while (originModel != null) {
if (!ArrayUtils.isEmpty(originModel.forks)) {
for (String fork : originModel.forks) {
if (!fork.startsWith(userPath)) {
- roots.add(fork);
+ roots.add(fork.toLowerCase());
}
}
}
if (originModel.originRepository != null) {
- roots.add(originModel.originRepository);
- originModel = repositoryListCache.get(originModel.originRepository);
+ String ooKey = originModel.originRepository.toLowerCase();
+ roots.add(ooKey);
+ originModel = repositoryListCache.get(ooKey);
} else {
// break
originModel = null;
@@ -973,7 +980,7 @@ public class RepositoryManager implements IRepositoryManager {
if (repository.startsWith(userPath)) {
RepositoryModel model = repositoryListCache.get(repository);
if (!StringUtils.isEmpty(model.originRepository)) {
- if (roots.contains(model.originRepository)) {
+ if (roots.contains(model.originRepository.toLowerCase())) {
// user has a fork in this graph
return model.name;
}
@@ -1013,7 +1020,7 @@ public class RepositoryManager implements IRepositoryManager {
// find the root, cached
RepositoryModel model = repositoryListCache.get(repository.toLowerCase());
while (model.originRepository != null) {
- model = repositoryListCache.get(model.originRepository);
+ model = repositoryListCache.get(model.originRepository.toLowerCase());
}
ForkModel root = getForkModelFromCache(model.name);
return root;
@@ -1344,7 +1351,7 @@ public class RepositoryManager implements IRepositoryManager {
// update this repository's origin's fork list
if (!StringUtils.isEmpty(repository.originRepository)) {
- RepositoryModel origin = repositoryListCache.get(repository.originRepository);
+ RepositoryModel origin = repositoryListCache.get(repository.originRepository.toLowerCase());
if (origin != null && !ArrayUtils.isEmpty(origin.forks)) {
origin.forks.remove(repositoryName);
origin.forks.add(repository.name);