notes: mention --notes in more places
PATCH 1/1 notes: mention --notes in more places
Every so often, I search 'git send-email --help' to remember some option I've used in the past, only to discover that the option is documented instead in 'git format-patch --help'. Worse, even that command didn't document the option I was looking for today, which was how to include 'git notes' in the body of the commits I was mailing. Reading 'git notes --help' didn't mention this either, and I had to resort to searching the source code. It can't hurt to add some documentation to make this option less obscure.
* git-notes.txt: Mention that --notes option exists in many commands to override defaults.
* git-format-patch.txt: Include pretty-options, for things like --notes.
* git-send-email.txt: Mention that revision lists forwarded to format-patch can also include options.
--- Documentation/git-format-patch.txt | 2 ++ Documentation/git-notes.txt | 6 ++++-- Documentation/git-send-email.txt | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-)
Documentation/git-format-patch.txt +2 -0
@@ -222,6 +222,8 @@ you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`. range are always formatted as creation patches, independently of this flag. +include::pretty-options.txt[] + CONFIGURATION ------------- You can specify extra mail header lines to be added to each message,
Documentation/git-notes.txt +4 -2
@@ -39,8 +39,10 @@ message stored in the commit object, the notes are indented like the message, after an unindented line saying "Notes (<refname>):" (or "Notes:" for `refs/notes/commits`). -To change which notes are shown by 'git log', see the -"notes.displayRef" configuration in linkgit:git-log[1]. +To change which notes are shown by default in 'git log', see the +"notes.displayRef" configuration in linkgit:git-log[1]. Also, +many commands understand a `--notes` option to alter the set of +notes displayed (see linkgit:git-rev-list[1]). See the "notes.rewrite.<command>" configuration for a way to carry notes across commands that rewrite commits.
Documentation/git-send-email.txt +2 -1
@@ -18,7 +18,8 @@ Takes the patches given on the command line and emails them out. Patches can be specified as files, directories (which will send all files in the directory), or directly as a revision list. In the last case, any format accepted by linkgit:git-format-patch[1] can -be passed to git send-email. +be passed to git send-email, including additional command line +options such as `--cover-letter` or `--notes`. The header of the email is configurable by command line options. If not specified on the command line, the user will be prompted with a ReadLine
Signature · 1 line
1.7.11.7
Quoted 8 lines · Eric Blake
Every so often, I search 'git send-email --help' to remember some option I've used in the past, only to discover that the option is documented instead in 'git format-patch --help'. Worse, even that command didn't document the option I was looking for today, which was how to include 'git notes' in the body of the commits I was mailing. Reading 'git notes --help' didn't mention this either, and I had to resort to searching the source code. It can't hurt to add some documentation to make this option less obscure.
I think this is a good direction, but...
Quoted 4 lines
* git-notes.txt: Mention that --notes option exists in many commands to override defaults.
* git-format-patch.txt: Include pretty-options, for things like --notes.
There are many things in pretty-options that would not be appropriate for format-patch. We should probably wrap them like this:
Documentation/pretty-options.txt +2 -0
@@ -1,3 +1,4 @@ +ifndef::git-format-patch[] --pretty[=<format>]:: --format=<format>::
@@ -27,6 +28,7 @@ people using 80-column terminals. --oneline:: This is a shorthand for "--pretty=oneline --abbrev-commit" used together. +endif::git-format-patch[] --encoding[=<encoding>]:: The commit objects record the encoding used for the log message
It may also make sense to show notes differently when outputting the "email" format as format-patch does. E.g., using a triple-dash would keep them separate from the commit message when using "git am". Like:
your commit message
Signed-off-by: You
---
your notes go here
We've talked about it several times, but it's never happened (probably because most people don't actually use notes).
-Peff
Quoted 4 lines · Jeff King
It may also make sense to show notes differently when outputting the "email" format as format-patch does. E.g., using a triple-dash would keep them separate from the commit message when using "git am". Like:
Quoted 8 lines
your commit message
Signed-off-by: You
---
your notes go hereWe've talked about it several times, but it's never happened (probably because most people don't actually use notes).
It is sometimes scary how we end up saying identical things independently :-)
Quoted 9 lines · Jeff King
It may also make sense to show notes differently when outputting the "email" format as format-patch does. E.g., using a triple-dash would keep them separate from the commit message when using "git am". Like:
your commit message
Signed-off-by: You
---
your notes go here
That's _precisely_ what I want! I want to use notes as a way of tracking my edits for what I did in v2 of a patch, at the time I commit my v2, so that I can send a revised series including the notes in a manner most efficient for someone else using 'git am' on the series to see why I sent a v2 but without polluting the upstream repository with useless versioning information from the email.
Quoted 3 lines
We've talked about it several times, but it's never happened (probably because most people don't actually use notes).
And people (like me) don't use notes because they aren't documented. Catch-22, so we have to start somewhere.
I'll submit a v2 with the non-controversial edits, and spend some time trying to figure out how to isolate the portion of pretty-options.txt that is relevant to format-patch. If it's easy enough, I can also consider using --- instead of Notes: as the separator when using format-patch.
Signature · 2 lines
Eric Blake [email protected] +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Quoted 5 lines · Eric Blake
Quoted 2 lines
We've talked about it several times, but it's never happened (probably because most people don't actually use notes).
And people (like me) don't use notes because they aren't documented. Catch-22, so we have to start somewhere.
Oh, I definitely agree your patch is the right direction. I was just explaining why it hasn't happened, even though people think it's a good idea.
Quoted 5 lines
I'll submit a v2 with the non-controversial edits, and spend some time trying to figure out how to isolate the portion of pretty-options.txt that is relevant to format-patch. If it's easy enough, I can also consider using --- instead of Notes: as the separator when using format-patch.
Hmm. After digging in the archive, it seems we (including both you and me!) have discussed this several times, and there are even some patches floating around. Maybe one of them would be a good starting point for your submission (I did not read carefully over all of the arguments for each):
Patch from Thomas, Feb 2010:
http://thread.gmane.org/gmane.comp.version-control.git/139919/focus=140818
Discussion between us, Dec 2010:
http://thread.gmane.org/gmane.comp.version-control.git/163141
Patch from Michael, Apr 2011:
http://thread.gmane.org/gmane.comp.version-control.git/172079
-Peff
Quoted 18 lines · Jeff King
Quoted 5 lines · Eric Blake
Quoted 2 lines
We've talked about it several times, but it's never happened (probably because most people don't actually use notes).
And people (like me) don't use notes because they aren't documented. Catch-22, so we have to start somewhere.
Oh, I definitely agree your patch is the right direction. I was just explaining why it hasn't happened, even though people think it's a good idea.
Quoted 5 lines
I'll submit a v2 with the non-controversial edits, and spend some time trying to figure out how to isolate the portion of pretty-options.txt that is relevant to format-patch. If it's easy enough, I can also consider using --- instead of Notes: as the separator when using format-patch.
Quoted 5 lines
Hmm. After digging in the archive, it seems we (including both you and me!) have discussed this several times, and there are even some patches floating around. Maybe one of them would be a good starting point for your submission (I did not read carefully over all of the arguments for each):
Thomas's oldest one looked like a good starting point but we've gained a codepath to spit out the contents of notes since then, which probably needs to be killed at least for this codepath.
A few problems I noticed while looking at log-tree.c and pretty.c
* pretty_print_commit() shows notes at the end of existing message. There is no provision for the callers to affect what comes between the existing log message and the notes text.
* show_log() has the "add-signoff" that appends a sign-off after whatever pretty_print_commit() gives.
Taken together, they make it unnecessarily cumbersome to inject a new sign-off and "---" between the log message and notes.
The easiest is to add another parameter to pretty_print_commit that is inserted immediately after the log message before notes are appended. That way, we can update show_log() to first format additional sign off (if needed) and then "---\n" (again, if needed) to a new strbuf and pass it as the new argument when calling the pretty_print_commit() function.
Quoted 6 lines · Eric Blake
* git-notes.txt: Mention that --notes option exists in many commands to override defaults.
* git-format-patch.txt: Include pretty-options, for things like --notes.
* git-send-email.txt: Mention that revision lists forwarded to format-patch can also include options.
Overall I feel fairly negative on this one, even though there are good bits.
Quoted 13 lines
Signed-off-by Eric Blake <[email protected]>--- Documentation/git-format-patch.txt | 2 ++ Documentation/git-notes.txt | 6 ++++-- Documentation/git-send-email.txt | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-)Documentation/git-format-patch.txt +0
-0
Documentation/git-format-patch.txt you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`. · line 225
Quoted 4 lines
Documentation/git-format-patch.txt +1
-0@@ -222,6 +222,8 @@ you can use `--suffix=-patch` to get `0001-description-of-my-change-patch`. range are always formatted as creation patches, independently of this flag. +include::pretty-options.txt[]
In the context of format-patch, the inclusion of pretty-options probably causes more harm than being helpful, I am afraid. If you use "--pretty=<format>", "--format=<format>", or "--oneline", the output will no longer be a proper mbox and is not suitable for asking somebody else to apply.
At the very least, you would need to add something like:
ifndef::git-format-patch[]
... enclose everything that should not be used with format-patch
endif::git-format-patch[]to the included file, and then define the token before the inclusion, like this:
:git-format-patch: 1
include::pretty-formats.txt[]to limit the damage.
Even with such a change to include only --notes, I am not sure if the result is something we would want to recommend/advertise to our users.
The output from format-patch with --notes shows the notes, after adding a blank line to the sign-off block, to look like this:
From: A U Thor <[email protected]>
Date: Tue, 16 Oct 2012 19:26:23 +0200
Subject: [PATCH] Gostak: distim the doshes correctly
With the current code, the Gostak cannot correctly distim the doshes, because ...
Notes:
This patch was inspired by Eric Blake
---
diff --git a/gostak b/gostak
...
I am not sure if this is suiable for sending to somebody and asking it to be applied.
Quoted 7 lines
Documentation/git-notes.txt +0
-0@@ -39,8 +39,10 @@ message stored in the commit object, the notes are indented like the message, after an unindented line saying "Notes (<refname>):" (or "Notes:" for `refs/notes/commits`).
Documentation/git-notes.txt message stored in the commit object, the notes are indented like the · line 48
Quoted 10 lines
Documentation/git-notes.txt +4
-2-To change which notes are shown by 'git log', see the -"notes.displayRef" configuration in linkgit:git-log[1]. +To change which notes are shown by default in 'git log', see the +"notes.displayRef" configuration in linkgit:git-log[1]. Also, +many commands understand a `--notes` option to alter the set of +notes displayed (see linkgit:git-rev-list[1]). See the "notes.rewrite.<command>" configuration for a way to carry notes across commands that rewrite commits.
OK.
Documentation/git-send-email.txt Takes the patches given on the command line and emails them out. · line 22
Quoted 11 lines
Documentation/git-send-email.txt +2
-1@@ -18,7 +18,8 @@ Takes the patches given on the command line and emails them out. Patches can be specified as files, directories (which will send all files in the directory), or directly as a revision list. In the last case, any format accepted by linkgit:git-format-patch[1] can -be passed to git send-email. +be passed to git send-email, including additional command line +options such as `--cover-letter` or `--notes`.
OK for --cover-letter, dubious on --notes.
Jeff King venit, vidit, dixit 17.10.2012 21:05:
Quoted 28 lines · Eric Blake
Quoted 6 lines
Quoted 3 lines
We've talked about it several times, but it's never happened (probably because most people don't actually use notes).
And people (like me) don't use notes because they aren't documented. Catch-22, so we have to start somewhere.
Oh, I definitely agree your patch is the right direction. I was just explaining why it hasn't happened, even though people think it's a good idea.
Quoted 5 lines
I'll submit a v2 with the non-controversial edits, and spend some time trying to figure out how to isolate the portion of pretty-options.txt that is relevant to format-patch. If it's easy enough, I can also consider using --- instead of Notes: as the separator when using format-patch.
Hmm. After digging in the archive, it seems we (including both you and me!) have discussed this several times, and there are even some patches floating around. Maybe one of them would be a good starting point for your submission (I did not read carefully over all of the arguments for each):
Patch from Thomas, Feb 2010:
http://thread.gmane.org/gmane.comp.version-control.git/139919/focus=140818
Quoted 7 lines
Discussion between us, Dec 2010:
http://thread.gmane.org/gmane.comp.version-control.git/163141Patch from Michael, Apr 2011:
http://thread.gmane.org/gmane.comp.version-control.git/172079
That one used to work for about one more year or so (it went through a few rebases) but stopped working during some rework involving the signature (signed-off-by), i.e. it puts the notes before the signed-off now. I didn't update it because nobody seemed interested anyway (and because branch-notes got implemented in a different, non-note way, so I dumped that part of my workflow also).
Michael