Skip to contentSkip to conversation

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

PATCH In review Junio C Hamano 2 participants 5 messages Feb 14, 2024 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 Documentation/git-am.txt | 3 +++
 apply.c                  | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
Documentation/git-am.txt +3 -0
index 82dadbecc8..67b12f315f 100644
@@ -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
apply.c +2 -1
index 3d69fec836..4e57831aeb 100644
@@ -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);
Signature · 1 line
2.44.0-rc1
#1 lore raw
Quoted 6 lines · Junio C Hamano

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.

Quoted 6 lines

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.

Looking to me, with one small nitpick below.

Documentation/git-am.txt include::rerere-options.txt[] · line 130

Quoted 13 lines
---
 Documentation/git-am.txt | 3 +++
 apply.c                  | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
Documentation/git-am.txt +0 -0
index 82dadbecc8..67b12f315f 100644
@@ -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.

It would be nice to, while there, move "the patch." to the line above.

Quoted 21 lines
Documentation/git-am.txt +3 -0
++
+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
apply.c +0 -0
index 3d69fec836..4e57831aeb 100644
@@ -78,7 +78,8 @@ static int parse_whitespace_option(struct

apply_state *state, const char *option

apply.c +2 -1
 		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 lore raw
Quoted 7 lines · Dragan Simic
Quoted 6 lines · Junio C Hamano

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.

Quoted 8 lines
Quoted 6 lines

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.

Looking to me, with one small nitpick below.

Oops... s/to me/good to me/
Sorry for the noise.

Quoted 37 lines

Documentation/git-am.txt include::rerere-options.txt[] · line 130

Quoted 13 lines
---
 Documentation/git-am.txt | 3 +++
 apply.c                  | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)
Documentation/git-am.txt +0 -0
index 82dadbecc8..67b12f315f 100644
@@ -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.

It would be nice to, while there, move "the patch." to the line above.

Quoted 21 lines
Documentation/git-am.txt +3 -0
++
+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
apply.c +0 -0
index 3d69fec836..4e57831aeb 100644
@@ -78,7 +78,8 @@ static int parse_whitespace_option(struct

apply_state *state, const char *option

apply.c +2 -1
 		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);
#3 lore raw
In reply to Dragan Simic
Quoted 6 lines · Dragan Simic

Documentation/git-am.txt include::rerere-options.txt[] · line 130

Quoted 4 lines
Documentation/git-am.txt +0 -0
@@ -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.

It would be nice to, while there, move "the patch." to the line above.

It belongs to a separate topic. These files are sources that will be line filled by AsciiDoc, so there is no reason to make such a change unless the topic of your change were to make the source "prettier", which is not the focus of this patch. Having such a change in the same patch will be distracting.

#4 lore raw
Quoted 10 lines · Junio C Hamano
Quoted 7 lines · Dragan Simic

Documentation/git-am.txt include::rerere-options.txt[] · line 131

Quoted 5 lines
Documentation/git-am.txt +0 -0
@@ -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.

It would be nice to, while there, move "the patch." to the line above.

Quoted 5 lines

It belongs to a separate topic. These files are sources that will be line filled by AsciiDoc, so there is no reason to make such a change unless the topic of your change were to make the source "prettier", which is not the focus of this patch. Having such a change in the same patch will be distracting.

Makes sense, it can become distracting, especially in a short patch like this one. It's better to stick to the patch topic, and leave small cleanups to a separate patch.