git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 14, 2024, 18:44 UTC
Message-ID
<xmqqplwyvqby.fsf@gitster.g>

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>
---
 Documentation/git-am.txt | 3 +++
 apply.c                  | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index 82dadbecc8..67b12f315f 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -128,6 +128,9 @@ include::rerere-options.txt[]
 	These flags are passed to the 'git apply' (see linkgit:git-apply[1])
 	program that applies
 	the patch.
++
+Valid <action> for the `--whitespace` option are:
+`nowarn`, `warn`, `fix`, `error`, and `error-all`.
 
 --patch-format::
 	By default the command will try to detect the patch format
diff --git a/apply.c b/apply.c
index 3d69fec836..4e57831aeb 100644
--- a/apply.c
+++ b/apply.c
@@ -78,7 +78,8 @@ static int parse_whitespace_option(struct apply_state *state, const char *option
 		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.
 	 */
 	return error(_("unrecognized whitespace option '%s'"), option);
-- 
2.44.0-rc1
Next: Dragan Simic
Message 1 of 5 in “doc: add shortcut to "am --whitespace=<action>"”
  1. doc: add shortcut to "am --whitespace=<action>"Junio C Hamano, Feb 14, 2024
  2. Dragan SimicFeb 14, 2024
  3. Dragan SimicFeb 14, 2024
  4. Junio C HamanoFeb 14, 2024
  5. Dragan SimicFeb 14, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.