1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-09 11:26:09 +02:00

Merge branch 'ds/cmd-main-reorder'

Code clean-up.

* ds/cmd-main-reorder:
  git.c: improve code readability in cmd_main()
This commit is contained in:
Junio C Hamano 2022-10-21 11:37:28 -07:00
commit 1f20aa22d7

14
git.c
View File

@ -894,12 +894,8 @@ int cmd_main(int argc, const char **argv)
argv++;
argc--;
handle_options(&argv, &argc, NULL);
if (argc > 0) {
if (!strcmp("--version", argv[0]) || !strcmp("-v", argv[0]))
argv[0] = "version";
else if (!strcmp("--help", argv[0]) || !strcmp("-h", argv[0]))
argv[0] = "help";
} else {
if (!argc) {
/* The user didn't specify a command; give them help */
commit_pager_choice();
printf(_("usage: %s\n\n"), git_usage_string);
@ -907,6 +903,12 @@ int cmd_main(int argc, const char **argv)
printf("\n%s\n", _(git_more_info_string));
exit(1);
}
if (!strcmp("--version", argv[0]) || !strcmp("-v", argv[0]))
argv[0] = "version";
else if (!strcmp("--help", argv[0]) || !strcmp("-h", argv[0]))
argv[0] = "help";
cmd = argv[0];
/*