diff options
author | James Moger <james.moger@gitblit.com> | 2011-09-26 08:50:04 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2011-09-26 08:50:04 -0400 |
commit | d7fb202c122faa90a75717cbd66791d3879b5776 (patch) | |
tree | 01b9db204c203c6b4aa8579ceb090b01110a470e /src/com | |
parent | dd9ae71bc1cb13b90dcc8d9689550eb7dfe7d035 (diff) | |
download | gitblit-d7fb202c122faa90a75717cbd66791d3879b5776.tar.gz gitblit-d7fb202c122faa90a75717cbd66791d3879b5776.zip |
Bare option for federation pull registrations. Documentation.
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/gitblit/FederationPullExecutor.java | 2 | ||||
-rw-r--r-- | src/com/gitblit/GitBlit.java | 3 | ||||
-rw-r--r-- | src/com/gitblit/models/FederationModel.java | 2 | ||||
-rw-r--r-- | src/com/gitblit/utils/JGitUtils.java | 9 | ||||
-rw-r--r-- | src/com/gitblit/wicket/pages/ReviewProposalPage.java | 1 |
5 files changed, 12 insertions, 5 deletions
diff --git a/src/com/gitblit/FederationPullExecutor.java b/src/com/gitblit/FederationPullExecutor.java index 50099861..f27ea3c2 100644 --- a/src/com/gitblit/FederationPullExecutor.java +++ b/src/com/gitblit/FederationPullExecutor.java @@ -182,7 +182,7 @@ public class FederationPullExecutor implements Runnable { logger.info(MessageFormat.format("Pulling federated repository {0} from {1} @ {2}",
repository.name, registration.name, registration.url));
CloneResult result = JGitUtils.cloneRepository(registrationFolderFile, repository.name,
- cloneUrl, credentials);
+ cloneUrl, registration.bare, credentials);
Repository r = GitBlit.self().getRepository(repositoryName);
RepositoryModel rm = GitBlit.self().getRepositoryModel(repositoryName);
repository.isFrozen = registration.mirror;
diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java index f3ad3634..c2b214b4 100644 --- a/src/com/gitblit/GitBlit.java +++ b/src/com/gitblit/GitBlit.java @@ -872,6 +872,9 @@ public class GitBlit implements ServletContextListener { } else if (setting.equals("folder")) {
// destination folder of the pull operation
federatedModels.get(server).folder = settings.getString(key, "");
+ } else if (setting.equals("bare")) {
+ // whether pulled repositories should be bare
+ federatedModels.get(server).bare = settings.getBoolean(key, true);
} else if (setting.equals("mirror")) {
// are the repositories to be true mirrors of the origin
federatedModels.get(server).mirror = settings.getBoolean(key, true);
diff --git a/src/com/gitblit/models/FederationModel.java b/src/com/gitblit/models/FederationModel.java index 39051909..efb1b322 100644 --- a/src/com/gitblit/models/FederationModel.java +++ b/src/com/gitblit/models/FederationModel.java @@ -45,6 +45,8 @@ public class FederationModel implements Serializable, Comparable<FederationModel public String frequency;
public String folder;
+
+ public boolean bare;
public boolean mirror;
diff --git a/src/com/gitblit/utils/JGitUtils.java b/src/com/gitblit/utils/JGitUtils.java index e61fea29..faca9cb6 100644 --- a/src/com/gitblit/utils/JGitUtils.java +++ b/src/com/gitblit/utils/JGitUtils.java @@ -159,7 +159,7 @@ public class JGitUtils { */
public static CloneResult cloneRepository(File repositoriesFolder, String name, String fromUrl)
throws Exception {
- return cloneRepository(repositoriesFolder, name, fromUrl, null);
+ return cloneRepository(repositoriesFolder, name, fromUrl, true, null);
}
/**
@@ -170,14 +170,15 @@ public class JGitUtils { * @param repositoriesFolder
* @param name
* @param fromUrl
+ * @param bare
* @param credentialsProvider
* @return CloneResult
* @throws Exception
*/
- public static CloneResult cloneRepository(File repositoriesFolder, String name, String fromUrl,
+ public static CloneResult cloneRepository(File repositoriesFolder, String name, String fromUrl, boolean bare,
CredentialsProvider credentialsProvider) throws Exception {
CloneResult result = new CloneResult();
- if (!name.toLowerCase().endsWith(Constants.DOT_GIT_EXT)) {
+ if (bare && !name.toLowerCase().endsWith(Constants.DOT_GIT_EXT)) {
name += Constants.DOT_GIT_EXT;
}
File folder = new File(repositoriesFolder, name);
@@ -188,7 +189,7 @@ public class JGitUtils { repository.close();
} else {
CloneCommand clone = new CloneCommand();
- clone.setBare(true);
+ clone.setBare(bare);
clone.setCloneAllBranches(true);
clone.setURI(fromUrl);
clone.setDirectory(folder);
diff --git a/src/com/gitblit/wicket/pages/ReviewProposalPage.java b/src/com/gitblit/wicket/pages/ReviewProposalPage.java index 0fc1de3d..b006d80f 100644 --- a/src/com/gitblit/wicket/pages/ReviewProposalPage.java +++ b/src/com/gitblit/wicket/pages/ReviewProposalPage.java @@ -80,6 +80,7 @@ public class ReviewProposalPage extends BasePage { sb.append(asParam(p, proposal.name, "frequency",
GitBlit.getString(Keys.federation.defaultFrequency, "60 mins")));
sb.append(asParam(p, proposal.name, "folder", proposal.name));
+ sb.append(asParam(p, proposal.name, "bare", "true"));
sb.append(asParam(p, proposal.name, "mirror", "true"));
sb.append(asParam(p, proposal.name, "sendStatus", "true"));
sb.append(asParam(p, proposal.name, "notifyOnError", "true"));
|