aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse
diff options
context:
space:
mode:
authorShawn Pearce <sop@google.com>2013-03-04 17:53:02 -0500
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2013-03-04 17:53:02 -0500
commit22625cd1d89257d9564d87c9bbbe8f4863c413e3 (patch)
tree240eab307d3d1742bc59f8fde963999cae729a40 /org.eclipse.jgit/src/org/eclipse
parent8d4f227c138bf3ccf13cf83ab63fde2fc49d3756 (diff)
parenta46b0429053288de4435ac26dc22f27f4ac43978 (diff)
downloadjgit-22625cd1d89257d9564d87c9bbbe8f4863c413e3.tar.gz
jgit-22625cd1d89257d9564d87c9bbbe8f4863c413e3.zip
Merge "Fix corrupted CloneCommand bare-repo fetch-refspec (#402031)"
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
index 22bda612fb..35bf75dcc4 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java
@@ -154,12 +154,13 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
RemoteConfig config = new RemoteConfig(clonedRepo.getConfig(), remote);
config.addURI(u);
- final String dst = bare ? Constants.R_HEADS : Constants.R_REMOTES
- + config.getName();
+ final String dst = (bare ? Constants.R_HEADS : Constants.R_REMOTES
+ + config.getName() + "/") + "*";
RefSpec refSpec = new RefSpec();
refSpec = refSpec.setForceUpdate(true);
refSpec = refSpec.setSourceDestination(
- Constants.R_HEADS + "*", dst + "/*"); //$NON-NLS-1$ //$NON-NLS-2$
+ Constants.R_HEADS + "*", dst); //$NON-NLS-1$ //$NON-NLS-2$
+
config.addFetchRefSpec(refSpec);
config.update(clonedRepo.getConfig());
@@ -182,7 +183,7 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> {
private List<RefSpec> calculateRefSpecs(final String dst) {
RefSpec wcrs = new RefSpec();
wcrs = wcrs.setForceUpdate(true);
- wcrs = wcrs.setSourceDestination(Constants.R_HEADS + "*", dst + "/*"); //$NON-NLS-1$ //$NON-NLS-2$
+ wcrs = wcrs.setSourceDestination(Constants.R_HEADS + "*", dst); //$NON-NLS-1$ //$NON-NLS-2$
List<RefSpec> specs = new ArrayList<RefSpec>();
if (cloneAllBranches)
specs.add(wcrs);