aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2019-10-20 18:08:59 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-10-21 09:29:52 +0200
commitc24eee4fa4db682b138a7a212cf711ab682d02f6 (patch)
treea0b756998f5ceb64fadef2b514f2cef68c8b9524 /org.eclipse.jgit.pgm
parentbceac7bd03e5a7660cb4f934f0db7ada7eab7b54 (diff)
downloadjgit-c24eee4fa4db682b138a7a212cf711ab682d02f6.tar.gz
jgit-c24eee4fa4db682b138a7a212cf711ab682d02f6.zip
[pgm] Add --mirror option to clone command
Bug: 552173 Change-Id: Ic8a98b2e0f8f29afd599723f93e51b06b9f13314 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties3
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java6
2 files changed, 8 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
index f02944265a..7cca02376b 100644
--- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
+++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
@@ -223,6 +223,9 @@ updating=Updating {0}..{1}
usage_Aggressive=This option will cause gc to more aggressively optimize the repository at the expense of taking much more time
usage_AlwaysFallback=Show uniquely abbreviated commit object as fallback
usage_bareClone=Make a bare Git repository. That is, instead of creating [DIRECTORY] and placing the administrative files in [DIRECTORY]/.git, make the [DIRECTORY] itself the $GIT_DIR.
+usage_mirrorClone=Set up a mirror of the source repository. This implies --bare. Compared to --bare, --mirror not only maps \
+local branches of the source to local branches of the target, it maps all refs (including remote-tracking branches, notes etc.) \
+and sets up a refspec configuration such that all these refs are overwritten by a git remote update in the target repository.
usage_Blame=Show what revision and author last modified each line
usage_Clean=Remove untracked files from the working tree
usage_CommandLineClientForamazonsS3Service=Command line client for Amazon's S3 service
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
index fe2462012b..a6a031e2c7 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
@@ -74,6 +74,9 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback {
@Option(name = "--bare", usage = "usage_bareClone")
private boolean isBare;
+ @Option(name = "--mirror", usage = "usage_mirrorClone")
+ private boolean isMirror;
+
@Option(name = "--quiet", usage = "usage_quiet")
private Boolean quiet;
@@ -103,7 +106,7 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback {
if (localName == null) {
try {
localName = uri.getHumanishName();
- if (isBare) {
+ if (isBare || isMirror) {
localName = localName + Constants.DOT_GIT_EXT;
}
localNameF = new File(SystemReader.getInstance().getProperty(
@@ -120,6 +123,7 @@ class Clone extends AbstractFetchCommand implements CloneCommand.Callback {
CloneCommand command = Git.cloneRepository();
command.setURI(sourceUri).setRemote(remoteName).setBare(isBare)
+ .setMirror(isMirror)
.setNoCheckout(noCheckout).setBranch(branch)
.setCloneSubmodules(cloneSubmodules);