From 45e93efe21e44fe02d4edc255d3f741538c18aa2 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sat, 17 May 2008 00:01:24 -0400 Subject: [PATCH] Add TagOpt support to Transport Currently we do not actually honor the setting, but we copy it from the RemoteConfig and allow applications to query/set the value once the Transport has been created for use. Signed-off-by: Shawn O. Pearce --- .../src/org/spearce/jgit/transport/Transport.java | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/Transport.java b/org.spearce.jgit/src/org/spearce/jgit/transport/Transport.java index 9a1688d8..565b2a9c 100644 --- a/org.spearce.jgit/src/org/spearce/jgit/transport/Transport.java +++ b/org.spearce.jgit/src/org/spearce/jgit/transport/Transport.java @@ -82,6 +82,7 @@ public abstract class Transport { final Transport tn = open(local, cfg.getURIs().get(0)); tn.setOptionUploadPack(cfg.getUploadPack()); tn.fetch = cfg.getFetchRefSpecs(); + tn.tagopt = cfg.getTagOpt(); return tn; } @@ -132,6 +133,17 @@ public abstract class Transport { private List fetch = Collections. emptyList(); /** + * How {@link #fetch(ProgressMonitor, Collection)} should handle tags. + *

+ * We default to {@link TagOpt#NO_TAGS} so as to avoid fetching annotated + * tags during one-shot fetches used for later merges. This prevents + * dragging down tags from repositories that we do not have established + * tracking branches for. If we do not track the source repository, we most + * likely do not care about any tags it publishes. + */ + private TagOpt tagopt = TagOpt.NO_TAGS; + + /** * Create a new transport instance. * * @param local @@ -181,6 +193,25 @@ public abstract class Transport { } /** + * Get the description of how annotated tags should be treated during fetch. + * + * @return option indicating the behavior of annotated tags in fetch. + */ + public TagOpt getTagOpt() { + return tagopt; + } + + /** + * Set the description of how annotated tags should be treated on fetch. + * + * @param option + * method to use when handling annotated tags. + */ + public void setTagOpt(final TagOpt option) { + tagopt = option != null ? option : TagOpt.AUTO_FOLLOW; + } + + /** * Fetch objects and refs from the remote repository to the local one. *

* This is a utility function providing standard fetch behavior. Local -- 2.11.4.GIT