]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jk/consistent-h'
authorJunio C Hamano <gitster@pobox.com>
Mon, 19 Jun 2017 19:38:45 +0000 (12:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 19 Jun 2017 19:38:45 +0000 (12:38 -0700)
"git $cmd -h" for builtin commands calls the implementation of the
command (i.e. cmd_$cmd() function) without doing any repository
set-up, and the commands that expect RUN_SETUP is done by the Git
potty needs to be prepared to show the help text without barfing.

* jk/consistent-h:
  t0012: test "-h" with builtins
  git: add hidden --list-builtins option
  version: convert to parse-options
  diff- and log- family: handle "git cmd -h" early
  submodule--helper: show usage for "-h"
  remote-{ext,fd}: print usage message on invalid arguments
  upload-archive: handle "-h" option early
  credential: handle invalid arguments earlier

1  2 
builtin/diff-files.c
builtin/diff-index.c
builtin/diff-tree.c
builtin/rev-list.c
builtin/submodule--helper.c
help.c

index a572da9d5152ddf541f71e1aaf8abdb3c98f8ffe,6be1df684a8459d7d2226faf9b28fbc55ea443b5..c97069a714e42a1737b5dfa223fe39c26ad9aa67
@@@ -20,9 -20,12 +20,12 @@@ int cmd_diff_files(int argc, const cha
        int result;
        unsigned options = 0;
  
+       if (argc == 2 && !strcmp(argv[1], "-h"))
+               usage(diff_files_usage);
 +      git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
        init_revisions(&rev, prefix);
        gitmodules_config();
 -      git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
        rev.abbrev = 0;
        precompose_argv(argc, argv);
  
index f084826a293f96870d0cf6be05e3e346672fc5dc,02dd35ba456ed4e0d12d4a1fe8fd58f0c4d406a1..d59bf6cf5f8da394251532765f27a044c14a572d
@@@ -17,9 -17,12 +17,12 @@@ int cmd_diff_index(int argc, const cha
        int i;
        int result;
  
+       if (argc == 2 && !strcmp(argv[1], "-h"))
+               usage(diff_cache_usage);
 +      git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
        init_revisions(&rev, prefix);
        gitmodules_config();
 -      git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
        rev.abbrev = 0;
        precompose_argv(argc, argv);
  
index 1fd06eac4b9b56dc2f3e21ef3045ff66507cdaf3,773cc254b5909713b2838db4ba52e7b6f9e88e60..7e15d01f36396fdc6b630eb43a5f36d462fb78e6
@@@ -104,9 -105,12 +104,12 @@@ int cmd_diff_tree(int argc, const char 
        struct setup_revision_opt s_r_opt;
        int read_stdin = 0;
  
+       if (argc == 2 && !strcmp(argv[1], "-h"))
+               usage(diff_tree_usage);
 +      git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
        init_revisions(opt, prefix);
        gitmodules_config();
 -      git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
        opt->abbrev = 0;
        opt->diff = 1;
        opt->disable_stdin = 1;
Simple merge
Simple merge
diff --cc help.c
Simple merge