From 3b91e3fe49154383006b83f900d68efee1c1777a Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 14 Mar 2011 08:53:41 -0700 Subject: [PATCH] Always fetch tags during clone C Git always fetches tags during clone, even if the tag doesn't point to an object that was fetched by the branch specifications. Match that behavior, as users expect it. Bug: 326611 Change-Id: I81a82b7359a9649f18a172219da44ed54e77ca2f Signed-off-by: Shawn O. Pearce --- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java | 2 ++ org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java | 2 ++ 2 files changed, 4 insertions(+) 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 73530efca..de430294f 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 @@ -69,6 +69,7 @@ import org.eclipse.jgit.storage.file.FileRepository; import org.eclipse.jgit.transport.FetchResult; import org.eclipse.jgit.transport.RefSpec; import org.eclipse.jgit.transport.RemoteConfig; +import org.eclipse.jgit.transport.TagOpt; import org.eclipse.jgit.transport.Transport; import org.eclipse.jgit.transport.URIish; import org.kohsuke.args4j.Argument; @@ -143,6 +144,7 @@ class Clone extends AbstractFetchCommand { final Transport tn = Transport.open(db, remoteName); final FetchResult r; try { + tn.setTagOpt(TagOpt.FETCH_TAGS); r = tn.fetch(new TextProgressMonitor(), null); } finally { tn.close(); 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 54457e523..0257f3264 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java @@ -66,6 +66,7 @@ import org.eclipse.jgit.transport.CredentialsProvider; import org.eclipse.jgit.transport.FetchResult; import org.eclipse.jgit.transport.RefSpec; import org.eclipse.jgit.transport.RemoteConfig; +import org.eclipse.jgit.transport.TagOpt; import org.eclipse.jgit.transport.URIish; /** @@ -149,6 +150,7 @@ public class CloneCommand implements Callable { FetchCommand command = new FetchCommand(repo); command.setRemote(remote); command.setProgressMonitor(monitor); + command.setTagOpt(TagOpt.FETCH_TAGS); if (credentialsProvider != null) command.setCredentialsProvider(credentialsProvider); return command.call();