You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

252 lines
8.1 KiB

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