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.

233 lines
7.5 KiB

  1. --- a/Makefile
  2. +++ b/Makefile
  3. @@ -532,16 +532,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. @@ -1002,6 +993,12 @@ BUILTIN_OBJS += builtin/var.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. @@ -1165,7 +1162,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. @@ -2049,10 +2046,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. @@ -2364,24 +2357,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. @@ -136,5 +136,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. @@ -1125,7 +1125,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. --- a/fast-import.c
  124. +++ b/fast-import.c
  125. @@ -3356,7 +3356,7 @@ static void parse_argv(void)
  126. read_marks();
  127. }
  128. -int main(int argc, char **argv)
  129. +int cmd_fast_import(int argc, char **argv, const char *prefix)
  130. {
  131. unsigned int i;
  132. --- a/git.c
  133. +++ b/git.c
  134. @@ -275,11 +275,11 @@ static int handle_alias(int *argcp, cons
  135. struct cmd_struct {
  136. const char *cmd;
  137. - int (*fn)(int, const char **, const char *);
  138. + int (*fn)(int, char **, const char *);
  139. int option;
  140. };
  141. -static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
  142. +static int run_builtin(struct cmd_struct *p, int argc, char **argv)
  143. {
  144. int status, help;
  145. struct stat st;
  146. @@ -359,6 +359,7 @@ static struct cmd_struct commands[] = {
  147. { "config", cmd_config, RUN_SETUP_GENTLY },
  148. { "count-objects", cmd_count_objects, RUN_SETUP },
  149. { "credential", cmd_credential, RUN_SETUP_GENTLY },
  150. + { "daemon", cmd_daemon },
  151. { "describe", cmd_describe, RUN_SETUP },
  152. { "diff", cmd_diff },
  153. { "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
  154. @@ -377,6 +378,8 @@ static struct cmd_struct commands[] = {
  155. { "grep", cmd_grep, RUN_SETUP_GENTLY },
  156. { "hash-object", cmd_hash_object },
  157. { "help", cmd_help },
  158. + { "http-backend", cmd_http_backend },
  159. + { "imap-send", cmd_imap_send },
  160. { "index-pack", cmd_index_pack, RUN_SETUP_GENTLY },
  161. { "init", cmd_init_db },
  162. { "init-db", cmd_init_db },
  163. @@ -424,6 +427,7 @@ static struct cmd_struct commands[] = {
  164. { "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
  165. { "rm", cmd_rm, RUN_SETUP },
  166. { "send-pack", cmd_send_pack, RUN_SETUP },
  167. + { "shell", cmd_shell },
  168. { "shortlog", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },
  169. { "show", cmd_show, RUN_SETUP },
  170. { "show-branch", cmd_show_branch, RUN_SETUP },
  171. @@ -440,6 +444,7 @@ static struct cmd_struct commands[] = {
  172. { "update-server-info", cmd_update_server_info, RUN_SETUP },
  173. { "upload-archive", cmd_upload_archive },
  174. { "upload-archive--writer", cmd_upload_archive_writer },
  175. + { "upload-pack", cmd_upload_pack },
  176. { "var", cmd_var, RUN_SETUP_GENTLY },
  177. { "verify-pack", cmd_verify_pack },
  178. { "verify-tag", cmd_verify_tag, RUN_SETUP },
  179. --- a/http-backend.c
  180. +++ b/http-backend.c
  181. @@ -563,7 +563,7 @@ static struct service_cmd {
  182. {"POST", "/git-receive-pack$", service_rpc}
  183. };
  184. -int main(int argc, char **argv)
  185. +int cmd_http_backend(int argc, char **argv, const char *prefix)
  186. {
  187. char *method = getenv("REQUEST_METHOD");
  188. char *dir;
  189. --- a/imap-send.c
  190. +++ b/imap-send.c
  191. @@ -1362,7 +1362,7 @@ static int git_imap_config(const char *k
  192. return 0;
  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. struct strbuf msg = STRBUF_INIT;
  199. --- a/shell.c
  200. +++ b/shell.c
  201. @@ -142,7 +142,7 @@ static struct commands {
  202. { NULL },
  203. };
  204. -int main(int argc, char **argv)
  205. +int cmd_shell(int argc, char **argv, const char *prefix)
  206. {
  207. char *prog;
  208. const char **user_argv;
  209. --- a/upload-pack.c
  210. +++ b/upload-pack.c
  211. @@ -790,7 +790,7 @@ static int upload_pack_config(const char
  212. return parse_hide_refs_config(var, value, "uploadpack");
  213. }
  214. -int main(int argc, char **argv)
  215. +int cmd_upload_pack(int argc, char **argv, const char *prefix)
  216. {
  217. char *dir;
  218. int i;