cli: add -v and -h shorthands
PATCH 1/1 cli: add -v and -h shorthands
If "-v" or "-h" is passed as a flag, they will be interpreted as a "version" or "help" command respectively.
---
I'm not sure if this was already discussed in the past or if there are reasons against this, but it would be quite handy if these shorthands existed for git.
Since this is my first patch for this project, I'm very happy to take your feedback!
Documentation/git.txt | 4 +++- git.c | 15 ++++++++++++--- po/bg.po | 4 ++-- po/ca.po | 4 ++-- po/de.po | 4 ++-- po/el.po | 4 ++-- po/es.po | 4 ++-- po/fr.po | 4 ++-- po/git.pot | 2 +- po/id.po | 4 ++-- po/it.po | 4 ++-- po/ko.po | 4 ++-- po/pl.po | 4 ++-- po/pt_PT.po | 2 +- po/ru.po | 4 ++-- po/sv.po | 4 ++-- po/tr.po | 4 ++-- po/vi.po | 4 ++-- po/zh_CN.po | 4 ++-- po/zh_TW.po | 4 ++-- t/t0012-help.sh | 2 +- 21 files changed, 50 insertions(+), 39 deletions(-)
Documentation/git.txt +3 -1
@@ -9,7 +9,7 @@ git - the stupid content tracker SYNOPSIS -------- [verse] -'git' [--version] [--help] [-C <path>] [-c <name>=<value>] +'git' [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare] [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
@@ -39,6 +39,7 @@ or https://git-scm.com/docs. OPTIONS ------- +-v:: --version:: Prints the Git suite version that the 'git' program came from. +
@@ -46,6 +47,7 @@ This option is internally converted to `git version ...` and accepts the same options as the linkgit:git-version[1] command. If `--help` is also given, it takes precedence over `--version`. +-h:: --help:: Prints the synopsis and a list of the most commonly used commands. If the option `--all` or `-a` is given then all
git.c +12 -3
@@ -25,7 +25,7 @@ struct cmd_struct { };const char git_usage_string[] = -N_ ("git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +N_ ("git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]\n" " [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
@@ -146,7 +146,10 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)* commands can be written with "--" prepended * to make them look like flags. */ -if (!strcmp (cmd,"--help" ) || !strcmp (cmd,"--version" )) +if (!strcmp (cmd,"-h" ) || + !strcmp (cmd,"--help" ) || + !strcmp (cmd,"-v" ) || + !strcmp (cmd,"--version" ))break ;/*
@@ -893,7 +896,13 @@ int cmd_main(int argc, const char **argv)handle_options (&argv, &argc,NULL );if (argc >0 ) {/* translate --help and --version into commands */ -skip_prefix (argv[0 ],"--" , &argv[0 ]); +if (!strcmp ("-v" , argv[0 ])) { + argv[0 ] ="version" ; + }else if (!strcmp ("-h" , argv[0 ])) { + argv[0 ] ="help" ; + }else { +skip_prefix (argv[0 ],"--" , &argv[0 ]); + } }else {/* The user didn't specify a command; give them help */ commit_pager_choice ();
po/bg.po +2 -2
@@ -24979,7 +24979,7 @@ msgstr "само за изчистване на грешки" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
@@ -24987,7 +24987,7 @@ msgid "" " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C ПЪТ] [-c ИМЕ=СТОЙНОСТ]\n" +"git [-v | --version] [-h | --help] [-C ПЪТ] [-c ИМЕ=СТОЙНОСТ]\n" " [--exec-path[=ПЪТ]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
po/ca.po +2 -2
@@ -24451,14 +24451,14 @@ msgstr "només útil per a la depuració" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]\n" " [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]\n" " [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
po/de.po +2 -2
@@ -24744,7 +24744,7 @@ msgstr "nur nützlich für Fehlersuche" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
@@ -24752,7 +24752,7 @@ msgid "" " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <Pfad>] [-c <Name>=<Wert>]\n" +"git [-v | --version] [-h | --help] [-C <Pfad>] [-c <Name>=<Wert>]\n" " [--exec-path[=<Pfad>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
po/el.po +2 -2
@@ -18927,14 +18927,14 @@ msgstr "" #: git.c:27 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n" " [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <διαδρομή>] [-c <όνομα>=<τιμή>]\n" +"git [-v | --version] [-h | --help] [-C <διαδρομή>] [-c <όνομα>=<τιμή>]\n" " [--exec-path[=<διαδρομή>]] [--html-path] [--man-path] [--info-" "path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
po/es.po +2 -2
@@ -24475,7 +24475,7 @@ msgstr "solo útil para depurar" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
@@ -24483,7 +24483,7 @@ msgid "" " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <ruta>] [-c <nombre>=<valor>]\n" +"git [-v | --version] [-h | --help] [-C <ruta>] [-c <nombre>=<valor>]\n" " [--exec-path [= <path>]] [--html-path] [--man-path] [--info-" "path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
po/fr.po +2 -2
@@ -24687,7 +24687,7 @@ msgstr "seulement utile pour le débogage" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
@@ -24695,7 +24695,7 @@ msgid "" " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <chemin>] [-c <nom>=<valeur>]\n" +"git [-v | --version] [-h | --help] [-C <chemin>] [-c <nom>=<valeur>]\n" " [--exec-path[=<chemin>]] [--html-path] [--man-path] [--info-" "path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
po/git.pot +1 -1
@@ -22653,7 +22653,7 @@ msgstr "" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
po/id.po +2 -2
@@ -23740,7 +23740,7 @@ msgstr "hanya berguna untuk penirkutuan" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
@@ -23748,7 +23748,7 @@ msgid "" " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <jalur>] [-c <nama>=<nilai>]\n" +"git [-v | --version] [-h | --help] [-C <jalur>] [-c <nama>=<nilai>]\n" " [--exec-path[=<jalur>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
po/it.po +2 -2
@@ -23422,14 +23422,14 @@ msgstr "esci subito dopo aver annunciato le funzionalità" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n" " [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <percorso>] [-c <nome>=<valore>]\n" +"git [-v | --version] [-h | --help] [-C <percorso>] [-c <nome>=<valore>]\n" " [--exec-path[=<percorso>]] [--html-path] [--man-path] [--info-" "path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
po/ko.po +2 -2
@@ -15225,14 +15225,14 @@ msgstr "디버깅 메시지를 표준오류로 출력합니다" #: git.c:27 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n" " [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <경로>] [-c <이름>=<값>]\n" +"git [-v | --version] [-h | --help] [-C <경로>] [-c <이름>=<값>]\n" " [--exec-path[=<경로>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
po/pl.po +2 -2
@@ -24406,7 +24406,7 @@ msgstr "przydatne tylko do odpluskwiania" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
@@ -24414,7 +24414,7 @@ msgid "" " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <ścieżka>] [-c <nazwa>=<wartość>]\n" +"git [-v | --version] [-h | --help] [-C <ścieżka>] [-c <nazwa>=<wartość>]\n" " [--exec-path[=<ścieżka>]] [--html-path] [--man-path] [--info-" "path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
po/pt_PT.po +1 -1
@@ -23666,7 +23666,7 @@ msgstr "apenas útil para depuração" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
po/ru.po +2 -2
@@ -21748,12 +21748,12 @@ msgstr "" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]\n" " [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n" " <command> [<args>]" -msgstr "git [--version] [--help] [-C <путь>] [-c <имя>=<значение>]\n [--exec-path[=<путь>]] [--html-path] [--man-path] [--info-path]\n [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]\n [--git-dir=<путь>] [--work-tree=<путь>] [--namespace=<имя>]\n <команда> [<аргументы>]" +msgstr "git [-v | --version] [-h | --help] [-C <путь>] [-c <имя>=<значение>]\n [--exec-path[=<путь>]] [--html-path] [--man-path] [--info-path]\n [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]\n [--git-dir=<путь>] [--work-tree=<путь>] [--namespace=<имя>]\n <команда> [<аргументы>]" #: git.c:35 msgid ""
po/sv.po +2 -2
@@ -24126,7 +24126,7 @@ msgstr "endast användbart vid felsökning" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
@@ -24134,7 +24134,7 @@ msgid "" " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <sökväg>] [-c <namn>=<värde>]\n" +"git [-v | --version] [-h | --help] [-C <sökväg>] [-c <namn>=<värde>]\n" " [--exec-path[=<sökväg>]] [--html-path] [--man-path] [--info-" "path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--"
po/tr.po +2 -2
@@ -24215,7 +24215,7 @@ msgstr "yalnızca hata ayıklama için yararlı" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
@@ -24223,7 +24223,7 @@ msgid "" " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <yol>] [-c <ad>=<değer>]\n" +"git [-v | --version] [-h | --help] [-C <yol>] [-c <ad>=<değer>]\n" " [--exec-path[=<yol>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
po/vi.po +2 -2
@@ -24290,7 +24290,7 @@ msgstr "chỉ hữu ích khi cần gỡ lỗi" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
@@ -24298,7 +24298,7 @@ msgid "" " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C </đường/dẫn/>] [-c <tên>=<giá trị>]\n" +"git [-v | --version] [-h | --help] [-C </đường/dẫn/>] [-c <tên>=<giá trị>]\n" " [--exec-path[=</đường/dẫn/>]] [--html-path] [--man-path] [--info-" "path]\n" " [-p | --paginate | -P --no-pager] [--no-replace-objects] [--"
po/zh_CN.po +2 -2
@@ -23838,7 +23838,7 @@ msgstr "只对调试有用" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
@@ -23846,7 +23846,7 @@ msgid "" " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <路径>] [-c <名称>=<取值>]\n" +"git [-v | --version] [-h | --help] [-C <路径>] [-c <名称>=<取值>]\n" " [--exec-path[=<路径>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
po/zh_TW.po +2 -2
@@ -23689,7 +23689,7 @@ msgstr "只對除錯有用" #: git.c:28 msgid "" -"git [--version] [--help] [-C <path>] [-c <name>=<value>]\n" +"git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]\n" " [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
@@ -23697,7 +23697,7 @@ msgid "" " [--super-prefix=<path>] [--config-env=<name>=<envvar>]\n" " <command> [<args>]" msgstr "" -"git [--version] [--help] [-C <路徑>] [-c <名稱>=<數值>]\n" +"git [-v | --version] [-h | --help] [-C <路徑>] [-c <名稱>=<數值>]\n" " [--exec-path[=<路徑>]] [--html-path] [--man-path] [--info-path]\n" " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--" "bare]\n"
t/t0012-help.sh +1 -1
@@ -181,7 +181,7 @@ for cmd in git "git help" do test_expect_success "'$cmd' section spacing" ' test_section_spacing_trailer git help <<-\EOF && - usage: git [--version] [--help] [-C <path>] [-c <name>=<value>] + usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>] These are common Git commands used in various situations:
Signature · 1 line
2.35.1
Quoted 2 lines · Garrit Franke
If "-v" or "-h" is passed as a flag, they will be interpreted as a "version" or "help" command respectively.
They won't, try e.g. "./git -h" before/after this change. On a second reading I see that there's an implied "change the behavior to ..." there.
But it would really help if the commit message discussed what we did before, what we do now, and why the change is safe/OK.
I *think* we just emit the message about an unknown option before, and this makes it synonymous with --verbose/verbose and --help/(but not "help"), but saying so would be useful :)
Quoted 2 lines
Since this is my first patch for this project, I'm very happy to take your feedback!
Welcome to git development!
Quoted 12 lines
Documentation/git.txt | 4 +++- git.c | 15 ++++++++++++--- po/bg.po | 4 ++-- po/ca.po | 4 ++-- po/de.po | 4 ++-- po/el.po | 4 ++-- po/es.po | 4 ++-- po/fr.po | 4 ++-- po/git.pot | 2 +- po/id.po | 4 ++-- po/it.po | 4 ++-- po/ko.po | 4 ++--
Quoted 8 lines
po/pl.po | 4 ++-- po/pt_PT.po | 2 +- po/ru.po | 4 ++-- po/sv.po | 4 ++-- po/tr.po | 4 ++-- po/vi.po | 4 ++-- po/zh_CN.po | 4 ++-- po/zh_TW.po | 4 ++--
This *.po stuff is a well-meaning change, but please leave this out of the patch.
The translation files are updated by a process that the translation teams(s) use, see po/README.md. I think changing this from under them is probably more disruptive than not.
git.c static int handle_options(const char ***argv, int *argc, int *envchanged) · line 152
Quoted 5 lines
git.c +4
-1-if (!strcmp (cmd,"--help" ) || !strcmp (cmd,"--version" )) +if (!strcmp (cmd,"-h" ) || + !strcmp (cmd,"--help" ) || + !strcmp (cmd,"-v" ) || + !strcmp (cmd,"--version" ))
nit: minimize the diff here perhaps by keeping the existing line, and doing -h or -v on a new line? Your indentation here is also off.
git.c int cmd_main(int argc, const char **argv) · line 905
Quoted 12 lines
git.c +7
-1@@ -893,7 +896,13 @@ int cmd_main(int argc, const char **argv)handle_options (&argv, &argc,NULL );if (argc >0 ) {/* translate --help and --version into commands */ -skip_prefix (argv[0 ],"--" , &argv[0 ]); +if (!strcmp ("-v" , argv[0 ])) { + argv[0 ] ="version" ; + }else if (!strcmp ("-h" , argv[0 ])) { + argv[0 ] ="help" ; + }else { +skip_prefix (argv[0 ],"--" , &argv[0 ]); + }
Don't use {} braces here, see CodingGudielines.
FWIW I have an existing branch (unsubmitted) at
https://github.com/avar/git/tree/avar/parse-options-h-3 where I added some tests for "git cmd -h" behavior, which seems to pass with this change (not unexpected, as this is for the top-level command).