@matheusbsbs / matheus-bagliano / commits / 3d7e2d857a
Fork 0

"git" returns 1; "git help" and "git help -a" return 0

Signed-off-by: Scott R Parish <srp@srparish.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Scott R Parish committed Oct 27, 2007 at 01:36 UTC 3d7e2d857a570b1d6368285f95b67994fc95629e
3 files changed +8 -6
builtin.h
+1
@@ -6,6 +6,7 @@
6 extern const char git_version_string[];
7 extern const char git_usage_string[];
8
9 +extern void list_common_cmds_help(void);
10 extern void help_unknown_cmd(const char *cmd);
11 extern int write_tree(unsigned char *sha1, int missing_ok, const char *prefix);
12 extern void prune_packed_objects(int);
git.c
+4 -3
@@ -450,9 +450,10 @@ int main(int argc, const char **argv)
450 if (!prefixcmp(argv[0], "--"))
451 argv[0] += 2;
452 } else {
453 - /* Default command: "help" */
454 - argv[0] = "help";
455 - argc = 1;
453 + /* The user didn't specify a command; give them help */
454 + printf("usage: %s\n\n", git_usage_string);
455 + list_common_cmds_help();
456 + exit(1);
457 }
458 cmd = argv[0];
459
help.c
+3 -3
@@ -147,7 +147,7 @@ static void list_commands(const char *exec_path, const char *pattern)
147 putchar('\n');
148 }
149
150 -static void list_common_cmds_help(void)
150 +void list_common_cmds_help(void)
151 {
152 int i, longest = 0;
153
@@ -203,14 +203,14 @@ int cmd_help(int argc, const char **argv, const char *prefix)
203 if (!help_cmd) {
204 printf("usage: %s\n\n", git_usage_string);
205 list_common_cmds_help();
206 - exit(1);
206 + exit(0);
207 }
208
209 else if (!strcmp(help_cmd, "--all") || !strcmp(help_cmd, "-a")) {
210 printf("usage: %s\n\n", git_usage_string);
211 if(exec_path)
212 list_commands(exec_path, "git-*");
213 - exit(1);
213 + exit(0);
214 }
215
216 else