summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2015-11-10 08:58:35 -0500
committerJames Moger <james.moger@gitblit.com>2015-11-10 08:58:35 -0500
commitc332d9a3d4d9485cfe60fb8dd9db7dbde971642c (patch)
treef9613053fdd73c92403cb33c5c09ea56ad45aa2b /src
parent168f0395252bb8e83b84ffab6e8fa17031bbb5bc (diff)
downloadgitblit-c332d9a3d4d9485cfe60fb8dd9db7dbde971642c.tar.gz
gitblit-c332d9a3d4d9485cfe60fb8dd9db7dbde971642c.zip
Do not display fork button if target repo already exists (fixes #944)
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/gitblit/wicket/pages/RepositoryPage.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java b/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java
index 9639a0c1..7e164a8c 100644
--- a/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java
+++ b/src/main/java/com/gitblit/wicket/pages/RepositoryPage.java
@@ -64,6 +64,7 @@ import com.gitblit.utils.ArrayUtils;
import com.gitblit.utils.BugtraqProcessor;
import com.gitblit.utils.DeepCopier;
import com.gitblit.utils.JGitUtils;
+import com.gitblit.utils.ModelUtils;
import com.gitblit.utils.RefLogUtils;
import com.gitblit.utils.StringUtils;
import com.gitblit.wicket.CacheControl;
@@ -370,8 +371,10 @@ public abstract class RepositoryPage extends RootPage {
add(new ExternalLink("myForkLink", "").setVisible(false));
} else {
String fork = app().repositories().getFork(user.username, model.name);
+ String userRepo = ModelUtils.getPersonalPath(user.username) + "/" + StringUtils.stripDotGit(StringUtils.getLastPathElement(model.name));
+ boolean hasUserRepo = app().repositories().hasRepository(userRepo);
boolean hasFork = fork != null;
- boolean canFork = user.canFork(model) && model.hasCommits;
+ boolean canFork = user.canFork(model) && model.hasCommits && !hasUserRepo;
if (hasFork || !canFork) {
// user not allowed to fork or fork already exists or repo forbids forking