git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[JGIT PATCH 5/6] Don't pass TagOpt to FetchProcess, get it from the Transport

From
Shawn O. Pearce <spearce@spearce.org>
Date
Feb 12, 2009, 23:54 UTC
Message-ID
<1234482880-1316-6-git-send-email-spearce@spearce.org>
In-Reply-To
<1234482880-1316-5-git-send-email-spearce@spearce.org>

We are already passing the transport down. Its just easier to get the tagopt off the transport than it is to pass it as an argument to the constructor.

In the future as we add more options into the Transport we will also need to obtain those in the FetchProcess, so directly querying the Transport will be more consistent.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../org/spearce/jgit/transport/FetchProcess.java   |    7 ++-----
 .../src/org/spearce/jgit/transport/Transport.java  |    2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/org.spearce.jgit/src/org/spearce/jgit/transport/FetchProcess.java b/org.spearce.jgit/src/org/spearce/jgit/transport/FetchProcess.java
index 09718eb..2ca8aeb 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/FetchProcess.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/FetchProcess.java
@@ -69,9 +69,6 @@
 	/** List of things we want to fetch from the remote repository. */
 	private final Collection<RefSpec> toFetch;
 
-	/** How to handle annotated tags, if any are advertised. */
-	private final TagOpt tagopt;
-
 	/** Set of refs we will actually wind up asking to obtain. */
 	private final HashMap<ObjectId, Ref> askFor = new HashMap<ObjectId, Ref>();
 
@@ -86,10 +83,9 @@
 
 	private FetchConnection conn;
 
-	FetchProcess(final Transport t, final Collection<RefSpec> f, final TagOpt o) {
+	FetchProcess(final Transport t, final Collection<RefSpec> f) {
 		transport = t;
 		toFetch = f;
-		tagopt = o;
 	}
 
 	void execute(final ProgressMonitor monitor, final FetchResult result)
@@ -114,6 +110,7 @@ void execute(final ProgressMonitor monitor, final FetchResult result)
 			}
 
 			Collection<Ref> additionalTags = Collections.<Ref> emptyList();
+			final TagOpt tagopt = transport.getTagOpt();
 			if (tagopt == TagOpt.AUTO_FOLLOW)
 				additionalTags = expandAutoFollowTags();
 			else if (tagopt == TagOpt.FETCH_TAGS)
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 28700b7..e58b72a 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/transport/Transport.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/transport/Transport.java
@@ -606,7 +606,7 @@ public FetchResult fetch(final ProgressMonitor monitor,
 		}
 
 		final FetchResult result = new FetchResult();
-		new FetchProcess(this, toFetch, tagopt).execute(monitor, result);
+		new FetchProcess(this, toFetch).execute(monitor, result);
 		return result;
 	}
 
-- 
1.6.2.rc0.226.gf08f
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 6 of 10 in “Add prune of stale tracking branches to fetch”
  1. 0/6 Add prune of stale tracking branches to fetchShawn O. Pearce, Feb 12, 2009
  2. 1/6 Fix RefUpdate.delete to update the result statusShawn O. Pearce, Feb 12, 2009
  3. 2/6 Add setBoolean, setInt to RepositoryConfigShawn O. Pearce, Feb 12, 2009
  4. 3/6 Add RefSpec.expandFromDestination for reverse mappingsShawn O. Pearce, Feb 12, 2009
  5. 4/6 Add the remote.name.mirror flag to RemoteConfigShawn O. Pearce, Feb 12, 2009
  6. 5/6 Don't pass TagOpt to FetchProcess, get it from the TransportShawn O. Pearce, Feb 12, 2009
  7. 6/6 Teach fetch to prune stale tracking branchesShawn O. Pearce, Feb 12, 2009
  8. Junio C HamanoFeb 13, 2009
  9. Shawn O. PearceFeb 13, 2009
  10. Junio C HamanoFeb 13, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.