Merge branch 'kh/notes-doc-fixes'

"git notes --help" documentation updates.

* kh/notes-doc-fixes:
  doc: notes: use stuck form throughout
  doc: notes: treat --stdin equally between copy/remove
  doc: notes: point out copy --stdin use with argv
  doc: notes: clearly state that --stripspace is the default
  doc: notes: remove stripspace discussion from other options
  doc: notes: rework --[no-]stripspace
  doc: notes: split out options with negated forms
  doc: config: mention core.commentChar on commit.cleanup
  doc: stripspace: mention where the default comes from
This commit is contained in:
Junio C Hamano
2025-05-30 11:59:17 -07:00
3 changed files with 37 additions and 25 deletions

View File

@@ -8,10 +8,11 @@ endif::git-commit[]
This setting overrides the default of the `--cleanup` option in This setting overrides the default of the `--cleanup` option in
`git commit`. {see-git-commit} Changing the default can be useful `git commit`. {see-git-commit} Changing the default can be useful
when you always want to keep lines that begin when you always want to keep lines that begin
with the comment character `#` in your log message, in which case you with the comment character (`core.commentChar`, default `#`)
in your log message, in which case you
would do `git config commit.cleanup whitespace` (note that you will would do `git config commit.cleanup whitespace` (note that you will
have to remove the help lines that begin with `#` in the commit log have to remove the help lines that begin with the comment character
template yourself, if you do this). in the commit log template yourself, if you do this).
`commit.gpgSign`:: `commit.gpgSign`::
A boolean to specify whether all commits should be GPG signed. A boolean to specify whether all commits should be GPG signed.

View File

@@ -87,6 +87,9 @@ In `--stdin` mode, take lines in the format
on standard input, and copy the notes from each _<from-object>_ to its on standard input, and copy the notes from each _<from-object>_ to its
corresponding _<to-object>_. (The optional _<rest>_ is ignored so that corresponding _<to-object>_. (The optional _<rest>_ is ignored so that
the command can read the input given to the `post-rewrite` hook.) the command can read the input given to the `post-rewrite` hook.)
+
`--stdin` cannot be combined with object names given on the command
line.
`append`:: `append`::
Append new message(s) given by `-m` or `-F` options to an Append new message(s) given by `-m` or `-F` options to an
@@ -124,6 +127,10 @@ When done, the user can either finalize the merge with
giving zero or one object from the command line, this is giving zero or one object from the command line, this is
equivalent to specifying an empty note message to equivalent to specifying an empty note message to
the `edit` subcommand. the `edit` subcommand.
+
In `--stdin` mode, also remove the object names given on standard
input. In other words, `--stdin` can be combined with object names from
the command line.
`prune`:: `prune`::
Remove all notes for non-existing/unreachable objects. Remove all notes for non-existing/unreachable objects.
@@ -144,26 +151,18 @@ OPTIONS
Use the given note message (instead of prompting). Use the given note message (instead of prompting).
If multiple `-m` options are given, their values If multiple `-m` options are given, their values
are concatenated as separate paragraphs. are concatenated as separate paragraphs.
Lines starting with `#` and empty lines other than a
single line between paragraphs will be stripped out.
If you wish to keep them verbatim, use `--no-stripspace`.
`-F <file>`:: `-F <file>`::
`--file=<file>`:: `--file=<file>`::
Take the note message from the given file. Use `-` to Take the note message from the given file. Use `-` to
read the note message from the standard input. read the note message from the standard input.
Lines starting with `#` and empty lines other than a
single line between paragraphs will be stripped out.
If you wish to keep them verbatim, use `--no-stripspace`.
`-C <object>`:: `-C <object>`::
`--reuse-message=<object>`:: `--reuse-message=<object>`::
Take the given blob object (for example, another note) as the Take the given blob object (for example, another note) as the
note message. (Use `git notes copy <object>` instead to note message. (Use `git notes copy <object>` instead to
copy notes between objects.). By default, message will be copy notes between objects.) Implies `--no-stripspace` since
copied verbatim, but if you wish to strip out the lines the default behavior is to copy the message verbatim.
starting with `#` and empty lines other than a single line
between paragraphs, use with `--stripspace` option.
`-c <object>`:: `-c <object>`::
`--reedit-message=<object>`:: `--reedit-message=<object>`::
@@ -174,21 +173,34 @@ OPTIONS
Allow an empty note object to be stored. The default behavior is Allow an empty note object to be stored. The default behavior is
to automatically remove empty notes. to automatically remove empty notes.
`--[no-]separator`::
`--separator=<paragraph-break>`:: `--separator=<paragraph-break>`::
`--separator`::
`--no-separator`::
Specify a string used as a custom inter-paragraph separator Specify a string used as a custom inter-paragraph separator
(a newline is added at the end as needed). If `--no-separator`, no (a newline is added at the end as needed). If `--no-separator`, no
separators will be added between paragraphs. Defaults to a blank separators will be added between paragraphs. Defaults to a blank
line. line.
`--[no-]stripspace`:: `--stripspace`::
Strip leading and trailing whitespace from the note message. `--no-stripspace`::
Also strip out empty lines other than a single line between Clean up whitespace. Specifically (see
paragraphs. Lines starting with `#` will be stripped out linkgit:git-stripspace[1]):
in non-editor cases like `-m`, `-F` and `-C`, but not in +
editor case like `git notes edit`, `-c`, etc. --
- remove trailing whitespace from all lines
- collapse multiple consecutive empty lines into one empty line
- remove empty lines from the beginning and end of the input
- add a missing `\n` to the last line if necessary.
--
+
`--stripspace` is the default except for
`-C`/`--reuse-message`. However, keep in mind that this depends on the
order of similar options. For example, for `-C <object> -m<message>`,
`--stripspace` will be used because the default for `-m` overrides the
previous `-C`. This is a known limitation that may be fixed in the
future.
`--ref <ref>`:: `--ref=<ref>`::
Manipulate the notes tree in _<ref>_. This overrides Manipulate the notes tree in _<ref>_. This overrides
`GIT_NOTES_REF` and the `core.notesRef` configuration. The ref `GIT_NOTES_REF` and the `core.notesRef` configuration. The ref
specifies the full refname when it begins with `refs/notes/`; when it specifies the full refname when it begins with `refs/notes/`; when it
@@ -200,9 +212,7 @@ OPTIONS
object that does not have notes attached to it. object that does not have notes attached to it.
`--stdin`:: `--stdin`::
Also read the object names to remove notes from the standard Only valid for `remove` and `copy`. See the respective subcommands.
input (there is no reason you cannot combine this with object
names from the command line).
`-n`:: `-n`::
`--dry-run`:: `--dry-run`::

View File

@@ -37,7 +37,8 @@ OPTIONS
------- -------
-s:: -s::
--strip-comments:: --strip-comments::
Skip and remove all lines starting with a comment character (default '#'). Skip and remove all lines starting with a comment character
(`core.commentChar`, default `#`).
-c:: -c::
--comment-lines:: --comment-lines::