@matheusbsbs / matheus-bagliano / commits / c9e388bb48
Fork 0

Make the "traditionally-supported" URLs a special case

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Daniel Barkalow committed Sep 3, 2009 at 22:13 UTC c9e388bb48bdafdf19574add915ab0ce33a1907d
4 files changed +6 -22
Makefile
+2 -15
@@ -981,8 +981,7 @@ else
981 else
982 CURL_LIBCURL = -lcurl
983 endif
984 - CURL_SYNONYMS = git-remote-https$X git-remote-ftp$X
985 - PROGRAMS += git-remote-http$X $(CURL_SYNONYMS) git-http-fetch$X
984 + PROGRAMS += git-remote-curl$X git-http-fetch$X
985 curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
986 ifeq "$(curl_check)" "070908"
987 ifndef NO_EXPAT
@@ -1497,16 +1496,10 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
1496 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1497 $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1498
1500 -git-remote-http$X: remote-curl.o http.o http-walker.o $(GITLIBS)
1499 +git-remote-curl$X: remote-curl.o http.o http-walker.o $(GITLIBS)
1500 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1501 $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1502
1504 -$(CURL_SYNONYMS): git-remote-http$X
1505 - $(QUIET_LNCP)$(RM) $@ && \
1506 - ln $< $@ 2>/dev/null || \
1507 - ln -s $< $@ 2>/dev/null || \
1508 - cp $< $@
1509 -
1503 $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
1504 $(patsubst git-%$X,%.o,$(PROGRAMS)) git.o: $(LIB_H) $(wildcard */*.h)
1505 builtin-revert.o wt-status.o: wt-status.h
@@ -1688,12 +1681,6 @@ endif
1681 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
1682 cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
1683 done; } && \
1691 - { for p in $(CURL_SYNONYMS); do \
1692 - $(RM) "$$execdir/$$p" && \
1693 - ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
1694 - ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
1695 - cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
1696 - done; } && \
1684 ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
1685
1686 install-doc:
transport-helper.c
+2 -5
@@ -152,13 +152,10 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
152 return ret;
153 }
154
155 -int transport_helper_init(struct transport *transport)
155 +int transport_helper_init(struct transport *transport, const char *name)
156 {
157 struct helper_data *data = xcalloc(sizeof(*data), 1);
158 - char *eom = strchr(transport->url, ':');
159 - if (!eom)
160 - return -1;
161 - data->name = xstrndup(transport->url, eom - transport->url);
158 + data->name = name;
159
160 transport->data = data;
161 transport->get_refs_list = get_refs_list;
transport.c
+1 -1
@@ -818,7 +818,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
818 } else if (!prefixcmp(url, "http://")
819 || !prefixcmp(url, "https://")
820 || !prefixcmp(url, "ftp://")) {
821 - transport_helper_init(ret);
821 + transport_helper_init(ret, "curl");
822 #ifdef NO_CURL
823 error("git was compiled without libcurl support.");
824 #else
transport.h
+1 -1
@@ -78,6 +78,6 @@ int transport_disconnect(struct transport *transport);
78 char *transport_anonymize_url(const char *url);
79
80 /* Transport methods defined outside transport.c */
81 -int transport_helper_init(struct transport *transport);
81 +int transport_helper_init(struct transport *transport, const char *name);
82
83 #endif