From 94dcbd617f3d06ca294d5d151390698e4bddd2cc Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Wed, 06 Jun 2012 17:00:21 -0400
Subject: [PATCH] Implemented default access restriction (issue 88)
---
src/com/gitblit/utils/JGitUtils.java | 27 ++-------------------------
1 files changed, 2 insertions(+), 25 deletions(-)
diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java
index 99b2f73..72e948c 100644
--- a/src/com/gitblit/utils/JGitUtils.java
+++ b/src/com/gitblit/utils/JGitUtils.java
@@ -36,8 +36,6 @@
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.FetchCommand;
import org.eclipse.jgit.api.Git;
-import org.eclipse.jgit.api.ResetCommand;
-import org.eclipse.jgit.api.ResetCommand.ResetType;
import org.eclipse.jgit.diff.DiffEntry;
import org.eclipse.jgit.diff.DiffEntry.ChangeType;
import org.eclipse.jgit.diff.DiffFormatter;
@@ -253,27 +251,6 @@
}
/**
- * Reset HEAD to the latest remote tracking commit.
- *
- * @param repository
- * @param remoteRef
- * the remote tracking reference (e.g. origin/master)
- * @return Ref
- * @throws Exception
- */
- public static Ref resetHEAD(Repository repository, String remoteRef) throws Exception {
- if (!remoteRef.startsWith(Constants.R_REMOTES)) {
- remoteRef = Constants.R_REMOTES + remoteRef;
- }
- Git git = new Git(repository);
- ResetCommand reset = git.reset();
- reset.setMode(ResetType.SOFT);
- reset.setRef(remoteRef);
- Ref result = reset.call();
- return result;
- }
-
- /**
* Creates a bare repository.
*
* @param repositoriesFolder
@@ -324,6 +301,7 @@
*/
private static List<String> getRepositoryList(String basePath, File searchFolder,
boolean onlyBare, boolean searchSubfolders) {
+ File baseFile = new File(basePath);
List<String> list = new ArrayList<String>();
for (File file : searchFolder.listFiles()) {
if (file.isDirectory()) {
@@ -333,8 +311,7 @@
continue;
}
// determine repository name relative to base path
- String repository = StringUtils.getRelativePath(basePath,
- file.getAbsolutePath());
+ String repository = FileUtils.getRelativePath(baseFile, file);
list.add(repository);
} else if (searchSubfolders && file.canRead()) {
// look for repositories in subfolders
--
Gitblit v1.9.1