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>
This commit is contained in:
Daniel Barkalow 2009-09-03 22:13:49 -04:00 committed by Junio C Hamano
parent ad17f01399
commit c9e388bb48
4 changed files with 6 additions and 22 deletions

View File

@ -981,8 +981,7 @@ else
else else
CURL_LIBCURL = -lcurl CURL_LIBCURL = -lcurl
endif endif
CURL_SYNONYMS = git-remote-https$X git-remote-ftp$X PROGRAMS += git-remote-curl$X git-http-fetch$X
PROGRAMS += git-remote-http$X $(CURL_SYNONYMS) git-http-fetch$X
curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p) curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
ifeq "$(curl_check)" "070908" ifeq "$(curl_check)" "070908"
ifndef NO_EXPAT ifndef NO_EXPAT
@ -1497,16 +1496,10 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(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,$^) \ $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(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) $(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
$(patsubst git-%$X,%.o,$(PROGRAMS)) git.o: $(LIB_H) $(wildcard */*.h) $(patsubst git-%$X,%.o,$(PROGRAMS)) git.o: $(LIB_H) $(wildcard */*.h)
builtin-revert.o wt-status.o: wt-status.h builtin-revert.o wt-status.o: wt-status.h
@ -1688,12 +1681,6 @@ endif
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \ ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \ cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
done; } && \ 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" ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
install-doc: install-doc:

View File

@ -152,13 +152,10 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
return ret; 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); struct helper_data *data = xcalloc(sizeof(*data), 1);
char *eom = strchr(transport->url, ':'); data->name = name;
if (!eom)
return -1;
data->name = xstrndup(transport->url, eom - transport->url);
transport->data = data; transport->data = data;
transport->get_refs_list = get_refs_list; transport->get_refs_list = get_refs_list;

View File

@ -818,7 +818,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
} else if (!prefixcmp(url, "http://") } else if (!prefixcmp(url, "http://")
|| !prefixcmp(url, "https://") || !prefixcmp(url, "https://")
|| !prefixcmp(url, "ftp://")) { || !prefixcmp(url, "ftp://")) {
transport_helper_init(ret); transport_helper_init(ret, "curl");
#ifdef NO_CURL #ifdef NO_CURL
error("git was compiled without libcurl support."); error("git was compiled without libcurl support.");
#else #else

View File

@ -78,6 +78,6 @@ int transport_disconnect(struct transport *transport);
char *transport_anonymize_url(const char *url); char *transport_anonymize_url(const char *url);
/* Transport methods defined outside transport.c */ /* Transport methods defined outside transport.c */
int transport_helper_init(struct transport *transport); int transport_helper_init(struct transport *transport, const char *name);
#endif #endif