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

[PATCH 1/2] clone, fetch: remove redundant transport check

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Dec 14, 2017, 21:44 UTC
Message-ID
<d1fd27a5a102129aa16ecf6e6c19014f7b60b543.1513287544.git.jonathantanmy@google.com>
In-Reply-To
<cover.1513287544.git.jonathantanmy@google.com>

Prior to commit a2d725b7bdf7 ("Use an external program to implement fetching with curl", 2009-08-05), if Git was compiled with NO_CURL, the get_refs_list and fetch methods in struct transport might not be populated, hence the checks in clone and fetch. After that commit, all transports populate get_refs_list and fetch, making the checks in clone and fetch redundant. Remove those checks.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
---
 builtin/clone.c | 3 ---
 builtin/fetch.c | 3 ---
 2 files changed, 6 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index dbddd98f8..979af0383 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -1083,9 +1083,6 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 		warning(_("--local is ignored"));
 	transport->cloning = 1;
 
-	if (!transport->get_refs_list || (!is_local && !transport->fetch))
-		die(_("Don't know how to clone %s"), transport->url);
-
 	transport_set_option(transport, TRANS_OPT_KEEP, "yes");
 
 	if (option_depth)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 225c73492..09eb1fc17 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1094,9 +1094,6 @@ static int do_fetch(struct transport *transport,
 			tags = TAGS_UNSET;
 	}
 
-	if (!transport->get_refs_list || !transport->fetch)
-		die(_("Don't know how to fetch from %s"), transport->url);
-
 	/* if not appending, truncate FETCH_HEAD */
 	if (!append && !dry_run) {
 		retcode = truncate_fetch_head();
-- 
2.15.1.504.g5279b80103-goog
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 5 in “More transport API improvements”
  1. 0/2 More transport API improvementsJonathan Tan, Dec 14, 2017
  2. 2/2 transport: make transport vtable more privateJonathan Tan, Dec 14, 2017
  3. Junio C HamanoDec 14, 2017
  4. 1/2 clone, fetch: remove redundant transport checkJonathan Tan, Dec 14, 2017
  5. Junio C HamanoDec 14, 2017

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.