doc: add shortcut to "am --whitespace=<action>"

We refer readers of "git am --help" to "git apply --help" for many
options that are passed through, and most of them are simple
booleans, but --whitespace takes from a set of actions whose names
may slip users' minds.  Give a list of them in "git am --help" to
reduce one level of redirection only to find out what they are.

In the helper function to parse the available options, there was a
helpful comment reminding the developer to update list of <action>s
in the completion script. Mention the two documentation pages there
as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano
2024-02-14 10:44:01 -08:00
parent 61a22ddaf0
commit a171dac734
2 changed files with 5 additions and 1 deletions

View File

@@ -128,6 +128,9 @@ include::rerere-options.txt[]
These flags are passed to the 'git apply' (see linkgit:git-apply[1]) These flags are passed to the 'git apply' (see linkgit:git-apply[1])
program that applies program that applies
the patch. the patch.
+
Valid <action> for the `--whitespace` option are:
`nowarn`, `warn`, `fix`, `error`, and `error-all`.
--patch-format:: --patch-format::
By default the command will try to detect the patch format By default the command will try to detect the patch format

View File

@@ -78,7 +78,8 @@ static int parse_whitespace_option(struct apply_state *state, const char *option
return 0; return 0;
} }
/* /*
* Please update $__git_whitespacelist in git-completion.bash * Please update $__git_whitespacelist in git-completion.bash,
* Documentation/git-apply.txt, and Documentation/git-am.txt
* when you add new options. * when you add new options.
*/ */
return error(_("unrecognized whitespace option '%s'"), option); return error(_("unrecognized whitespace option '%s'"), option);