Skip to content

Commit 28ca0c9

Browse files
Ilari Liusvaaragitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b236752 commit 28ca0c9

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@
107107
/git-relink
108108
/git-remote
109109
/git-remote-curl
110+
/git-remote-http
111+
/git-remote-https
112+
/git-remote-ftp
113+
/git-remote-ftps
110114
/git-repack
111115
/git-replace
112116
/git-repo-config

Makefile

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,16 @@ BUILT_INS += git-stage$X
424424
BUILT_INS += git-status$X
425425
BUILT_INS += git-whatchanged$X
426426

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+
427437
# what 'all' will build and 'install' will install in gitexecdir,
428438
# excluding programs for built-in commands
429439
ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
@@ -1097,7 +1107,7 @@ else
10971107
else
10981108
CURL_LIBCURL = -lcurl
10991109
endif
1100-
PROGRAMS += git-remote-curl$X git-http-fetch$X
1110+
PROGRAMS += $(REMOTE_CURL_NAMES) git-http-fetch$X
11011111
curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
11021112
ifeq "$(curl_check)" "070908"
11031113
ifndef NO_EXPAT
@@ -1676,7 +1686,13 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
16761686
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
16771687
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
16781688

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)
16801696
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
16811697
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
16821698

@@ -1852,6 +1868,7 @@ endif
18521868
ifneq (,$X)
18531869
$(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';)
18541870
endif
1871+
18551872
bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
18561873
execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
18571874
{ test "$$bindir/" = "$$execdir/" || \
@@ -1865,6 +1882,12 @@ endif
18651882
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
18661883
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
18671884
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; } && \
18681891
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
18691892

18701893
install-doc:

transport.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -918,14 +918,6 @@ struct transport *transport_get(struct remote *remote, const char *url)
918918

919919
data->conn = NULL;
920920
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
929921
} else {
930922
/* Unknown protocol in URL. Pass to external handler. */
931923
int len = external_specification_len(url);

0 commit comments

Comments
 (0)