git: add subpackage for http(s)/ftp(s) commands
[feed/packages.git] / net / git / patches / 100-convert_builtin.patch
1 --- a/Makefile
2 +++ b/Makefile
3 @@ -538,16 +538,7 @@ EXTRA_PROGRAMS =
4 # ... and all the rest that could be moved out of bindir to gitexecdir
5 PROGRAMS += $(EXTRA_PROGRAMS)
6
7 -PROGRAM_OBJS += credential-store.o
8 -PROGRAM_OBJS += daemon.o
9 -PROGRAM_OBJS += fast-import.o
10 -PROGRAM_OBJS += http-backend.o
11 -PROGRAM_OBJS += imap-send.o
12 -PROGRAM_OBJS += sh-i18n--envsubst.o
13 -PROGRAM_OBJS += shell.o
14 -PROGRAM_OBJS += show-index.o
15 -PROGRAM_OBJS += upload-pack.o
16 -PROGRAM_OBJS += remote-testsvn.o
17 +PROGRAM_OBJS += http-backend.o
18
19 # Binary suffix, set to .exe for Windows builds
20 X =
21 @@ -896,6 +887,11 @@ BUILTIN_OBJS += builtin/verify-commit.o
22 BUILTIN_OBJS += builtin/verify-pack.o
23 BUILTIN_OBJS += builtin/verify-tag.o
24 BUILTIN_OBJS += builtin/write-tree.o
25 +BUILTIN_OBJS += builtin/daemon.o
26 +BUILTIN_OBJS += builtin/fast-import.o
27 +BUILTIN_OBJS += builtin/imap-send.o
28 +BUILTIN_OBJS += builtin/shell.o
29 +BUILTIN_OBJS += builtin/upload-pack.o
30
31 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
32 EXTLIBS =
33 @@ -1070,7 +1067,7 @@ endif
34 EXTLIBS += -lz
35
36 ifndef NO_OPENSSL
37 - OPENSSL_LIBSSL = -lssl
38 + EXTLIBS += -lssl
39 ifdef OPENSSLDIR
40 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
41 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
42 @@ -1933,10 +1930,6 @@ endif
43 git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
44 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
45
46 -git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
47 - $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
48 - $(LIBS) $(IMAP_SEND_LDFLAGS)
49 -
50 git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
51 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
52 $(LIBS) $(CURL_LIBCURL)
53 @@ -2254,10 +2247,11 @@ endif
54 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
55 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
56 { test "$$bindir/" = "$$execdir/" || \
57 - for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
58 + for p in $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
59 $(RM) "$$execdir/$$p" && \
60 test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
61 ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
62 + ln -s git "$$execdir/$$p" 2>/dev/null || \
63 cp "$$bindir/$$p" "$$execdir/$$p" || exit; \
64 done; \
65 } && \
66 --- a/builtin.h
67 +++ b/builtin.h
68 @@ -138,5 +138,10 @@ extern int cmd_verify_pack(int argc, con
69 extern int cmd_show_ref(int argc, const char **argv, const char *prefix);
70 extern int cmd_pack_refs(int argc, const char **argv, const char *prefix);
71 extern int cmd_replace(int argc, const char **argv, const char *prefix);
72 +extern int cmd_daemon(int argc, char **argv, const char *prefix);
73 +extern int cmd_fast_import(int argc, char **argv, const char *prefix);
74 +extern int cmd_imap_send(int argc, char **argv, const char *prefix);
75 +extern int cmd_shell(int argc, char **argv, const char *prefix);
76 +extern int cmd_upload_pack(int argc, char **argv, const char *prefix);
77
78 #endif
79 --- /dev/null
80 +++ b/builtin/daemon.c
81 @@ -0,0 +1 @@
82 +#include "../daemon.c"
83 --- /dev/null
84 +++ b/builtin/fast-import.c
85 @@ -0,0 +1 @@
86 +#include "../fast-import.c"
87 --- /dev/null
88 +++ b/builtin/imap-send.c
89 @@ -0,0 +1 @@
90 +#include "../imap-send.c"
91 --- /dev/null
92 +++ b/builtin/shell.c
93 @@ -0,0 +1 @@
94 +#include "../shell.c"
95 --- /dev/null
96 +++ b/builtin/upload-pack.c
97 @@ -0,0 +1 @@
98 +#include "../upload-pack.c"
99 --- a/daemon.c
100 +++ b/daemon.c
101 @@ -1096,7 +1096,7 @@ static int serve(struct string_list *lis
102 return service_loop(&socklist);
103 }
104
105 -int main(int argc, char **argv)
106 +int cmd_daemon(int argc, char **argv, const char *prefix)
107 {
108 int listen_port = 0;
109 struct string_list listen_addr = STRING_LIST_INIT_NODUP;
110 @@ -1292,12 +1292,13 @@ int main(int argc, char **argv)
111 store_pid(pid_file);
112
113 /* prepare argv for serving-processes */
114 - cld_argv = xmalloc(sizeof (char *) * (argc + 2));
115 - cld_argv[0] = argv[0]; /* git-daemon */
116 - cld_argv[1] = "--serve";
117 + cld_argv = xmalloc(sizeof (char *) * (argc + 3));
118 + cld_argv[0] = "git";
119 + cld_argv[1] = argv[0]; /* daemon */
120 + cld_argv[2] = "--serve";
121 for (i = 1; i < argc; ++i)
122 - cld_argv[i+1] = argv[i];
123 - cld_argv[argc+1] = NULL;
124 + cld_argv[i+2] = argv[i];
125 + cld_argv[argc+2] = NULL;
126
127 return serve(&listen_addr, listen_port, cred);
128 }
129 --- a/fast-import.c
130 +++ b/fast-import.c
131 @@ -3350,7 +3350,7 @@ static void parse_argv(void)
132 read_marks();
133 }
134
135 -int main(int argc, char **argv)
136 +int cmd_fast_import(int argc, char **argv, const char *prefix)
137 {
138 unsigned int i;
139
140 --- a/git.c
141 +++ b/git.c
142 @@ -309,11 +309,11 @@ static int handle_alias(int *argcp, cons
143
144 struct cmd_struct {
145 const char *cmd;
146 - int (*fn)(int, const char **, const char *);
147 + int (*fn)(int, char **, const char *);
148 int option;
149 };
150
151 -static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
152 +static int run_builtin(struct cmd_struct *p, int argc, char **argv)
153 {
154 int status, help;
155 struct stat st;
156 @@ -393,6 +393,7 @@ static struct cmd_struct commands[] = {
157 { "config", cmd_config, RUN_SETUP_GENTLY },
158 { "count-objects", cmd_count_objects, RUN_SETUP },
159 { "credential", cmd_credential, RUN_SETUP_GENTLY },
160 + { "daemon", cmd_daemon },
161 { "describe", cmd_describe, RUN_SETUP },
162 { "diff", cmd_diff },
163 { "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
164 @@ -411,6 +412,7 @@ static struct cmd_struct commands[] = {
165 { "grep", cmd_grep, RUN_SETUP_GENTLY },
166 { "hash-object", cmd_hash_object },
167 { "help", cmd_help },
168 + { "imap-send", cmd_imap_send },
169 { "index-pack", cmd_index_pack, RUN_SETUP_GENTLY },
170 { "init", cmd_init_db, NO_SETUP },
171 { "init-db", cmd_init_db, NO_SETUP },
172 @@ -459,6 +462,7 @@ static struct cmd_struct commands[] = {
173 { "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
174 { "rm", cmd_rm, RUN_SETUP },
175 { "send-pack", cmd_send_pack, RUN_SETUP },
176 + { "shell", cmd_shell },
177 { "shortlog", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },
178 { "show", cmd_show, RUN_SETUP },
179 { "show-branch", cmd_show_branch, RUN_SETUP },
180 @@ -475,6 +479,7 @@ static struct cmd_struct commands[] = {
181 { "update-server-info", cmd_update_server_info, RUN_SETUP },
182 { "upload-archive", cmd_upload_archive },
183 { "upload-archive--writer", cmd_upload_archive_writer },
184 + { "upload-pack", cmd_upload_pack },
185 { "var", cmd_var, RUN_SETUP_GENTLY },
186 { "verify-commit", cmd_verify_commit, RUN_SETUP },
187 { "verify-pack", cmd_verify_pack },
188 --- a/imap-send.c
189 +++ b/imap-send.c
190 @@ -1484,7 +1484,7 @@ static int curl_append_msgs_to_imap(stru
191 }
192 #endif
193
194 -int main(int argc, char **argv)
195 +int cmd_imap_send(int argc, char **argv, const char *prefix)
196 {
197 struct strbuf all_msgs = STRBUF_INIT;
198 int total;
199 --- a/shell.c
200 +++ b/shell.c
201 @@ -138,7 +138,7 @@ static struct commands {
202 { NULL },
203 };
204
205 -int main(int argc, char **argv)
206 +int cmd_shell(int argc, char **argv, const char *prefix)
207 {
208 char *prog;
209 const char **user_argv;
210 --- a/upload-pack.c
211 +++ b/upload-pack.c
212 @@ -793,7 +793,7 @@ static int upload_pack_config(const char
213 return parse_hide_refs_config(var, value, "uploadpack");
214 }
215
216 -int main(int argc, char **argv)
217 +int cmd_upload_pack(int argc, char **argv, const char *prefix)
218 {
219 char *dir;
220 int i;