diff mbox series

cli: add -v and -h shorthands

Message ID 20220330170059.5075-1-garrit@slashdev.space (mailing list archive)
State Superseded
Headers show
Series cli: add -v and -h shorthands | expand

Commit Message

Garrit Franke March 30, 2022, 5 p.m. UTC
If "-v" or "-h" is passed as a flag, they will be interpreted as
a "version" or "help" command respectively.

Signed-off-by: Garrit Franke <garrit@slashdev.space>
---
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(-)

Comments

Ævar Arnfjörð Bjarmason March 30, 2022, 5:17 p.m. UTC | #1
On Wed, Mar 30 2022, Garrit Franke wrote:

> 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 :)

> Since this is my first patch for this project, I'm very happy to take
> your feedback!

Welcome to git development!

>  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 ++--

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.

> -		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.

> @@ -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).
diff mbox series

Patch

diff --git a/Documentation/git.txt b/Documentation/git.txt
index 13f83a2..302607a 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -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
diff --git a/git.c b/git.c
index a25940d..6888c11 100644
--- a/git.c
+++ b/git.c
@@ -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();
diff --git a/po/bg.po b/po/bg.po
index 8328531..7f9994b 100644
--- a/po/bg.po
+++ b/po/bg.po
@@ -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"
diff --git a/po/ca.po b/po/ca.po
index afcffad..33ecccf 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -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"
diff --git a/po/de.po b/po/de.po
index 19ffd9a..0ea3f93 100644
--- a/po/de.po
+++ b/po/de.po
@@ -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"
diff --git a/po/el.po b/po/el.po
index 703f46d..7191847 100644
--- a/po/el.po
+++ b/po/el.po
@@ -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] [--"
diff --git a/po/es.po b/po/es.po
index ced2eb6..a812bf4 100644
--- a/po/es.po
+++ b/po/es.po
@@ -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] [--"
diff --git a/po/fr.po b/po/fr.po
index fc00401..da60c9c 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -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] [--"
diff --git a/po/git.pot b/po/git.pot
index 196249a..2cb3747 100644
--- a/po/git.pot
+++ b/po/git.pot
@@ -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"
diff --git a/po/id.po b/po/id.po
index aa6f170..edb702e 100644
--- a/po/id.po
+++ b/po/id.po
@@ -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"
diff --git a/po/it.po b/po/it.po
index c315608..d003e24 100644
--- a/po/it.po
+++ b/po/it.po
@@ -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] [--"
diff --git a/po/ko.po b/po/ko.po
index 5d190e5..bd41856 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -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"
diff --git a/po/pl.po b/po/pl.po
index 0ec127e..de64558 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -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] [--"
diff --git a/po/pt_PT.po b/po/pt_PT.po
index 70e5c6d..912cb12 100644
--- a/po/pt_PT.po
+++ b/po/pt_PT.po
@@ -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"
diff --git a/po/ru.po b/po/ru.po
index 993d106..2de033a 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -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 ""
diff --git a/po/sv.po b/po/sv.po
index fd32ede..8b1b1d8 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -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] [--"
diff --git a/po/tr.po b/po/tr.po
index 6afb871..0f39310 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -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"
diff --git a/po/vi.po b/po/vi.po
index 0d5b144..f3ba1bb 100644
--- a/po/vi.po
+++ b/po/vi.po
@@ -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] [--"
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 484f2d8..a91a280 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -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"
diff --git a/po/zh_TW.po b/po/zh_TW.po
index 60fe123..5cad03c 100644
--- a/po/zh_TW.po
+++ b/po/zh_TW.po
@@ -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"
diff --git a/t/t0012-help.sh b/t/t0012-help.sh
index 6c3e1f7..6c33a43 100755
--- a/t/t0012-help.sh
+++ b/t/t0012-help.sh
@@ -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: