Browse Source

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 <spearce@spearce.org>
stable-0.12
Shawn O. Pearce 14 years ago
parent
commit
3b91e3fe49
  1. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java

2
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();

2
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<Git> {
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();

Loading…
Cancel
Save