Build-in "git-shell"
This trivially makes "git-shell" a built-in. It makes the executable even fatter, though. And MinGW removed git-shell only because of the funny dependencies; there is no reason to do so anymore. Signed-off-by: Junio C Hamano <gitster@pobox.com> Tested-on-MinGW-by: Johannes Sixt <johannes.sixt@telecom.at>
Junio C Hamano committed
Aug 19, 2008 at 18:05 UTC
daa0cc9a92c9c2c714aa5f7da6d0ff65b93e0698
4 files changed
+6
-3
Makefile
+1
-1
@@ -546,6 +546,7 @@ BUILTIN_OBJS += builtin-rev-parse.o
546
BUILTIN_OBJS += builtin-revert.o
547
BUILTIN_OBJS += builtin-rm.o
548
BUILTIN_OBJS += builtin-send-pack.o
549
+BUILTIN_OBJS += builtin-shell.o
550
BUILTIN_OBJS += builtin-shortlog.o
551
BUILTIN_OBJS += builtin-show-branch.o
552
BUILTIN_OBJS += builtin-show-ref.o
@@ -821,7 +822,6 @@ EXTLIBS += -lz
822
ifndef NO_POSIX_ONLY_PROGRAMS
823
PROGRAMS += git-daemon$X
824
PROGRAMS += git-imap-send$X
824
- PROGRAMS += git-shell$X
825
endif
826
ifndef NO_OPENSSL
827
OPENSSL_LIBSSL = -lssl
builtin-shell.c
renamed
+3
-2
@@ -2,6 +2,7 @@
2
#include "quote.h"
3
#include "exec_cmd.h"
4
#include "strbuf.h"
5
+#include "builtin.h"
6
7
static int do_generic_cmd(const char *me, char *arg)
8
{
@@ -44,7 +45,7 @@ static struct commands {
45
{ NULL },
46
};
47
47
-int main(int argc, char **argv)
48
+int cmd_shell(int argc, const char **argv, const char *prefix)
49
{
50
char *prog;
51
struct commands *cmd;
@@ -62,7 +63,7 @@ int main(int argc, char **argv)
63
else if (argc != 3 || strcmp(argv[1], "-c"))
64
die("What do you think I am? A shell?");
65
65
- prog = argv[2];
66
+ prog = xstrdup(argv[2]);
67
if (!strncmp(prog, "git", 3) && isspace(prog[3]))
68
/* Accept "git foo" as if the caller said "git-foo". */
69
prog[3] = '-';
builtin.h
+1
@@ -88,6 +88,7 @@ extern int cmd_rev_parse(int argc, const char **argv, const char *prefix);
88
extern int cmd_revert(int argc, const char **argv, const char *prefix);
89
extern int cmd_rm(int argc, const char **argv, const char *prefix);
90
extern int cmd_send_pack(int argc, const char **argv, const char *prefix);
91
+extern int cmd_shell(int argc, const char **argv, const char *prefix);
92
extern int cmd_shortlog(int argc, const char **argv, const char *prefix);
93
extern int cmd_show(int argc, const char **argv, const char *prefix);
94
extern int cmd_show_branch(int argc, const char **argv, const char *prefix);
git.c
+1
@@ -338,6 +338,7 @@ static void handle_internal_command(int argc, const char **argv)
338
{ "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
339
{ "rm", cmd_rm, RUN_SETUP },
340
{ "send-pack", cmd_send_pack, RUN_SETUP },
341
+ { "shell", cmd_shell },
342
{ "shortlog", cmd_shortlog, USE_PAGER },
343
{ "show-branch", cmd_show_branch, RUN_SETUP },
344
{ "show", cmd_show, RUN_SETUP | USE_PAGER },