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)
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
19 # Binary suffix, set to .exe for Windows builds
21 @@ -896,6 +887,12 @@ 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/http-backend.o
28 +BUILTIN_OBJS += builtin/imap-send.o
29 +BUILTIN_OBJS += builtin/shell.o
30 +BUILTIN_OBJS += builtin/upload-pack.o
32 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
34 @@ -1070,7 +1067,7 @@ endif
38 - OPENSSL_LIBSSL = -lssl
41 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
42 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
43 @@ -1933,10 +1930,6 @@ endif
44 git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
45 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
47 -git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
48 - $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
49 - $(LIBS) $(IMAP_SEND_LDFLAGS)
51 git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
52 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
53 $(LIBS) $(CURL_LIBCURL)
54 @@ -2254,24 +2247,22 @@ endif
55 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
56 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
57 { test "$$bindir/" = "$$execdir/" || \
58 - for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
59 + for p in $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
60 $(RM) "$$execdir/$$p" && \
61 test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
62 - ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
63 + ln -s git "$$execdir/$$p" 2>/dev/null || \
64 cp "$$bindir/$$p" "$$execdir/$$p" || exit; \
67 for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
68 $(RM) "$$bindir/$$p" && \
69 test -z "$(NO_INSTALL_HARDLINKS)" && \
70 - ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
71 ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
72 cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
74 for p in $(BUILT_INS); do \
75 $(RM) "$$execdir/$$p" && \
76 test -z "$(NO_INSTALL_HARDLINKS)" && \
77 - ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
78 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
79 cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
83 @@ -138,5 +138,11 @@ extern int cmd_verify_pack(int argc, con
84 extern int cmd_show_ref(int argc, const char **argv, const char *prefix);
85 extern int cmd_pack_refs(int argc, const char **argv, const char *prefix);
86 extern int cmd_replace(int argc, const char **argv, const char *prefix);
87 +extern int cmd_daemon(int argc, char **argv, const char *prefix);
88 +extern int cmd_fast_import(int argc, char **argv, const char *prefix);
89 +extern int cmd_http_backend(int argc, char **argv, const char *prefix);
90 +extern int cmd_imap_send(int argc, char **argv, const char *prefix);
91 +extern int cmd_shell(int argc, char **argv, const char *prefix);
92 +extern int cmd_upload_pack(int argc, char **argv, const char *prefix);
96 +++ b/builtin/daemon.c
98 +#include "../daemon.c"
100 +++ b/builtin/fast-import.c
102 +#include "../fast-import.c"
104 +++ b/builtin/http-backend.c
106 +#include "../http-backend.c"
108 +++ b/builtin/imap-send.c
110 +#include "../imap-send.c"
112 +++ b/builtin/shell.c
114 +#include "../shell.c"
116 +++ b/builtin/upload-pack.c
118 +#include "../upload-pack.c"
121 @@ -1096,7 +1096,7 @@ static int serve(struct string_list *lis
122 return service_loop(&socklist);
125 -int main(int argc, char **argv)
126 +int cmd_daemon(int argc, char **argv, const char *prefix)
129 struct string_list listen_addr = STRING_LIST_INIT_NODUP;
130 @@ -1292,12 +1292,13 @@ int main(int argc, char **argv)
133 /* prepare argv for serving-processes */
134 - cld_argv = xmalloc(sizeof (char *) * (argc + 2));
135 - cld_argv[0] = argv[0]; /* git-daemon */
136 - cld_argv[1] = "--serve";
137 + cld_argv = xmalloc(sizeof (char *) * (argc + 3));
138 + cld_argv[0] = "git";
139 + cld_argv[1] = argv[0]; /* daemon */
140 + cld_argv[2] = "--serve";
141 for (i = 1; i < argc; ++i)
142 - cld_argv[i+1] = argv[i];
143 - cld_argv[argc+1] = NULL;
144 + cld_argv[i+2] = argv[i];
145 + cld_argv[argc+2] = NULL;
147 return serve(&listen_addr, listen_port, cred);
151 @@ -3350,7 +3350,7 @@ static void parse_argv(void)
155 -int main(int argc, char **argv)
156 +int cmd_fast_import(int argc, char **argv, const char *prefix)
162 @@ -309,11 +309,11 @@ static int handle_alias(int *argcp, cons
166 - int (*fn)(int, const char **, const char *);
167 + int (*fn)(int, char **, const char *);
171 -static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
172 +static int run_builtin(struct cmd_struct *p, int argc, char **argv)
176 @@ -393,6 +393,7 @@ static struct cmd_struct commands[] = {
177 { "config", cmd_config, RUN_SETUP_GENTLY },
178 { "count-objects", cmd_count_objects, RUN_SETUP },
179 { "credential", cmd_credential, RUN_SETUP_GENTLY },
180 + { "daemon", cmd_daemon },
181 { "describe", cmd_describe, RUN_SETUP },
182 { "diff", cmd_diff },
183 { "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
184 @@ -411,6 +412,8 @@ static struct cmd_struct commands[] = {
185 { "grep", cmd_grep, RUN_SETUP_GENTLY },
186 { "hash-object", cmd_hash_object },
187 { "help", cmd_help },
188 + { "http-backend", cmd_http_backend },
189 + { "imap-send", cmd_imap_send },
190 { "index-pack", cmd_index_pack, RUN_SETUP_GENTLY },
191 { "init", cmd_init_db, NO_SETUP },
192 { "init-db", cmd_init_db, NO_SETUP },
193 @@ -459,6 +462,7 @@ static struct cmd_struct commands[] = {
194 { "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
195 { "rm", cmd_rm, RUN_SETUP },
196 { "send-pack", cmd_send_pack, RUN_SETUP },
197 + { "shell", cmd_shell },
198 { "shortlog", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },
199 { "show", cmd_show, RUN_SETUP },
200 { "show-branch", cmd_show_branch, RUN_SETUP },
201 @@ -475,6 +479,7 @@ static struct cmd_struct commands[] = {
202 { "update-server-info", cmd_update_server_info, RUN_SETUP },
203 { "upload-archive", cmd_upload_archive },
204 { "upload-archive--writer", cmd_upload_archive_writer },
205 + { "upload-pack", cmd_upload_pack },
206 { "var", cmd_var, RUN_SETUP_GENTLY },
207 { "verify-commit", cmd_verify_commit, RUN_SETUP },
208 { "verify-pack", cmd_verify_pack },
211 @@ -557,7 +557,7 @@ static struct service_cmd {
212 {"POST", "/git-receive-pack$", service_rpc}
215 -int main(int argc, char **argv)
216 +int cmd_http_backend(int argc, char **argv, const char *prefix)
218 char *method = getenv("REQUEST_METHOD");
222 @@ -1484,7 +1484,7 @@ static int curl_append_msgs_to_imap(stru
226 -int main(int argc, char **argv)
227 +int cmd_imap_send(int argc, char **argv, const char *prefix)
229 struct strbuf all_msgs = STRBUF_INIT;
233 @@ -138,7 +138,7 @@ static struct commands {
237 -int main(int argc, char **argv)
238 +int cmd_shell(int argc, char **argv, const char *prefix)
241 const char **user_argv;
244 @@ -793,7 +793,7 @@ static int upload_pack_config(const char
245 return parse_hide_refs_config(var, value, "uploadpack");
248 -int main(int argc, char **argv)
249 +int cmd_upload_pack(int argc, char **argv, const char *prefix)