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

[PATCH 1/8] Make the "traditionally-supported" URLs a special case

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Sep 4, 2009, 02:13 UTC
Message-ID
<alpine.LNX.2.00.0909032213180.28290@iabervon.org>

Instead of trying to make http://, https://, and ftp:// URLs indicative of some sort of pattern of transport helper usage, make them a special case which runs the "curl" helper, and leave the mechanism by which arbitrary helpers will be chosen entirely to future work.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
---
 Makefile           |   17 ++---------------
 transport-helper.c |    7 ++-----
 transport.c        |    2 +-
 transport.h        |    2 +-
 4 files changed, 6 insertions(+), 22 deletions(-)
diff --git a/Makefile b/Makefile
index 263e191..3ac12ec 100644
--- a/Makefile
+++ b/Makefile
@@ -972,8 +972,7 @@ else
 	else
 		CURL_LIBCURL = -lcurl
 	endif
-	CURL_SYNONYMS = git-remote-https$X git-remote-ftp$X
-	PROGRAMS += git-remote-http$X $(CURL_SYNONYMS) git-http-fetch$X
+	PROGRAMS += git-remote-curl$X git-http-fetch$X
 	curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
 	ifeq "$(curl_check)" "070908"
 		ifndef NO_EXPAT
@@ -1483,16 +1482,10 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
-git-remote-http$X: remote-curl.o http.o http-walker.o $(GITLIBS)
+git-remote-curl$X: remote-curl.o http.o http-walker.o $(GITLIBS)
 	$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 		$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 
-$(CURL_SYNONYMS): git-remote-http$X
-	$(QUIET_LNCP)$(RM) $@ && \
-	ln $< $@ 2>/dev/null || \
-	ln -s $< $@ 2>/dev/null || \
-	cp $< $@
-
 $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
 $(patsubst git-%$X,%.o,$(PROGRAMS)) git.o: $(LIB_H) $(wildcard */*.h)
 builtin-revert.o wt-status.o: wt-status.h
@@ -1674,12 +1667,6 @@ endif
 		ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
 		cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
 	  done; } && \
-	{ for p in $(CURL_SYNONYMS); do \
-		$(RM) "$$execdir/$$p" && \
-		ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
-		ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
-		cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
-	  done; } && \
 	./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
 
 install-doc:
diff --git a/transport-helper.c b/transport-helper.c
index 43fdc0a..4684877 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -152,13 +152,10 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
 	return ret;
 }
 
-int transport_helper_init(struct transport *transport)
+int transport_helper_init(struct transport *transport, const char *name)
 {
 	struct helper_data *data = xcalloc(sizeof(*data), 1);
-	char *eom = strchr(transport->url, ':');
-	if (!eom)
-		return -1;
-	data->name = xstrndup(transport->url, eom - transport->url);
+	data->name = name;
 
 	transport->data = data;
 	transport->get_refs_list = get_refs_list;
diff --git a/transport.c b/transport.c
index f2bd998..4cb8077 100644
--- a/transport.c
+++ b/transport.c
@@ -823,7 +823,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
 	} else if (!prefixcmp(url, "http://")
 	        || !prefixcmp(url, "https://")
 	        || !prefixcmp(url, "ftp://")) {
-		transport_helper_init(ret);
+		transport_helper_init(ret, "curl");
 #ifdef NO_CURL
 		error("git was compiled without libcurl support.");
 #else
diff --git a/transport.h b/transport.h
index bfd542f..c14da6f 100644
--- a/transport.h
+++ b/transport.h
@@ -80,6 +80,6 @@ int transport_disconnect(struct transport *transport);
 char *transport_anonymize_url(const char *url);
 
 /* Transport methods defined outside transport.c */
-int transport_helper_init(struct transport *transport);
+int transport_helper_init(struct transport *transport, const char *name);
 
 #endif
-- 
1.6.4.2.419.gc86f8
Next: Sverre Rabbelier
Message 1 of 18 in “Make the "traditionally-supported" URLs a special case”
  1. 1/8 Make the "traditionally-supported" URLs a special caseDaniel Barkalow, Sep 4, 2009
  2. Sverre RabbelierSep 4, 2009
  3. Daniel BarkalowSep 4, 2009
  4. Sverre RabbelierSep 4, 2009
  5. Junio C HamanoSep 4, 2009
  6. Sverre RabbelierSep 4, 2009
  7. Johannes SchindelinSep 4, 2009
  8. Daniel BarkalowSep 4, 2009
  9. Sverre RabbelierSep 4, 2009
  10. Daniel BarkalowSep 4, 2009
  11. Johannes SchindelinSep 4, 2009
  12. Daniel BarkalowSep 4, 2009
  13. Johannes SchindelinSep 4, 2009
  14. Mike RalphsonSep 4, 2009
  15. Johannes SchindelinSep 4, 2009
  16. Junio C HamanoSep 4, 2009
  17. Johannes SchindelinSep 4, 2009
  18. Sverre RabbelierSep 4, 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.