Remove special casing of http, https and ftp
HTTP, HTTPS and FTP are no longer special to transport code. Also add support for FTPS (curl supports it so it is easy). Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ilari Liusvaara committed
Dec 9, 2009 at 17:26 UTC
28ca0c90080ec933d82b0f7d050ea5fde2816c57
3 files changed
+29
-10
.gitignore
+4
@@ -107,6 +107,10 @@
107
/git-relink
108
/git-remote
109
/git-remote-curl
110
+/git-remote-http
111
+/git-remote-https
112
+/git-remote-ftp
113
+/git-remote-ftps
114
/git-repack
115
/git-replace
116
/git-repo-config
Makefile
+25
-2
@@ -424,6 +424,16 @@ BUILT_INS += git-stage$X
424
BUILT_INS += git-status$X
425
BUILT_INS += git-whatchanged$X
426
427
+ifdef NO_CURL
428
+REMOTE_CURL_PRIMARY =
429
+REMOTE_CURL_ALIASES =
430
+REMOTE_CURL_NAMES =
431
+else
432
+REMOTE_CURL_PRIMARY = git-remote-http$X
433
+REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
434
+REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
435
+endif
436
+
437
# what 'all' will build and 'install' will install in gitexecdir,
438
# excluding programs for built-in commands
439
ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
@@ -1097,7 +1107,7 @@ else
1107
else
1108
CURL_LIBCURL = -lcurl
1109
endif
1100
- PROGRAMS += git-remote-curl$X git-http-fetch$X
1110
+ PROGRAMS += $(REMOTE_CURL_NAMES) git-http-fetch$X
1111
curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
1112
ifeq "$(curl_check)" "070908"
1113
ifndef NO_EXPAT
@@ -1676,7 +1686,13 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
1686
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1687
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1688
1679
-git-remote-curl$X: remote-curl.o http.o http-walker.o $(GITLIBS)
1689
+$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
1690
+ $(QUIET_LNCP)$(RM) $@ && \
1691
+ ln $< $@ 2>/dev/null || \
1692
+ ln -s $< $@ 2>/dev/null || \
1693
+ cp $< $@
1694
+
1695
+$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o $(GITLIBS)
1696
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1697
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1698
@@ -1852,6 +1868,7 @@ endif
1868
ifneq (,$X)
1869
$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), test '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p' -ef '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p$X' || $(RM) '$(DESTDIR_SQ)$(gitexec_instdir_SQ)/$p';)
1870
endif
1871
+
1872
bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
1873
execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
1874
{ test "$$bindir/" = "$$execdir/" || \
@@ -1865,6 +1882,12 @@ endif
1882
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
1883
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
1884
done; } && \
1885
+ { for p in $(REMOTE_CURL_ALIASES); do \
1886
+ $(RM) "$$execdir/$$p" && \
1887
+ ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
1888
+ ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
1889
+ cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
1890
+ done; } && \
1891
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
1892
1893
install-doc:
transport.c
-8
@@ -918,14 +918,6 @@ struct transport *transport_get(struct remote *remote, const char *url)
918
919
data->conn = NULL;
920
data->got_remote_heads = 0;
921
- } else if (!prefixcmp(url, "http://")
922
- || !prefixcmp(url, "https://")
923
- || !prefixcmp(url, "ftp://")) {
924
- /* These three are just plain special. */
925
- transport_helper_init(ret, "curl");
926
-#ifdef NO_CURL
927
- error("git was compiled without libcurl support.");
928
-#endif
921
} else {
922
/* Unknown protocol in URL. Pass to external handler. */
923
int len = external_specification_len(url);