summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1666246)
raw | patch | inline | side by side (parent: 1666246)
author | Greg Brockman <gdb@MIT.EDU> | |
Fri, 27 Aug 2010 05:36:13 +0000 (01:36 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 27 Aug 2010 17:43:59 +0000 (10:43 -0700) |
The interface for split_cmdline has changed such that the caller holds
responsibility for printing any error messages. This patch changes
the git shell to print these error messages as appropriate.
Signed-off-by: Greg Brockman <gdb@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
responsibility for printing any error messages. This patch changes
the git shell to print these error messages as appropriate.
Signed-off-by: Greg Brockman <gdb@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
shell.c | patch | blob | history |
index f0f6c2d3be924e976fe1bbc7e962b8ceaf83f37d..dea4cfdd2c230af6afd6233cacfa5c776a9962f9 100644 (file)
--- a/shell.c
+++ b/shell.c
const char *prog;
char *full_cmd;
char *rawargs;
+ char *split_args;
const char **argv;
int code;
+ int count;
fprintf(stderr, "git> ");
if (strbuf_getline(&line, stdin, '\n') == EOF) {
}
strbuf_trim(&line);
rawargs = strbuf_detach(&line, NULL);
- if (split_cmdline(rawargs, &argv) == -1) {
+ split_args = xstrdup(rawargs);
+ count = split_cmdline(split_args, &argv);
+ if (count < 0) {
+ fprintf(stderr, "invalid command format '%s': %s\n", rawargs,
+ split_cmdline_strerror(count));
+ free(split_args);
free(rawargs);
continue;
}
const char **user_argv;
struct commands *cmd;
int devnull_fd;
+ int count;
/*
* Always open file descriptors 0/1/2 to avoid clobbering files
}
cd_to_homedir();
- if (split_cmdline(prog, &user_argv) != -1) {
+ count = split_cmdline(prog, &user_argv);
+ if (count >= 0) {
if (is_valid_cmd_name(user_argv[0])) {
prog = make_cmd(user_argv[0]);
user_argv[0] = prog;
die("unrecognized command '%s'", argv[2]);
} else {
free(prog);
- die("invalid command format '%s'", argv[2]);
+ die("invalid command format '%s': %s", argv[2],
+ split_cmdline_strerror(count));
}
}