Skip to content

Commit c9e388b

Browse files
iabervongitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ad17f01 commit c9e388b

File tree

4 files changed

+6
-22
lines changed

4 files changed

+6
-22
lines changed

Makefile

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -981,8 +981,7 @@ else
981981
else
982982
CURL_LIBCURL = -lcurl
983983
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
986985
curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
987986
ifeq "$(curl_check)" "070908"
988987
ifndef NO_EXPAT
@@ -1497,16 +1496,10 @@ git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
14971496
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
14981497
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
14991498

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

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-
15101503
$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
15111504
$(patsubst git-%$X,%.o,$(PROGRAMS)) git.o: $(LIB_H) $(wildcard */*.h)
15121505
builtin-revert.o wt-status.o: wt-status.h
@@ -1688,12 +1681,6 @@ endif
16881681
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
16891682
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
16901683
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; } && \
16971684
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
16981685

16991686
install-doc:

transport-helper.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,10 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
152152
return ret;
153153
}
154154

155-
int transport_helper_init(struct transport *transport)
155+
int transport_helper_init(struct transport *transport, const char *name)
156156
{
157157
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;
162159

163160
transport->data = data;
164161
transport->get_refs_list = get_refs_list;

transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
818818
} else if (!prefixcmp(url, "http://")
819819
|| !prefixcmp(url, "https://")
820820
|| !prefixcmp(url, "ftp://")) {
821-
transport_helper_init(ret);
821+
transport_helper_init(ret, "curl");
822822
#ifdef NO_CURL
823823
error("git was compiled without libcurl support.");
824824
#else

transport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ int transport_disconnect(struct transport *transport);
7878
char *transport_anonymize_url(const char *url);
7979

8080
/* 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);
8282

8383
#endif

0 commit comments

Comments
 (0)