notes: document behavior of --ref and --notes DWIMery
PATCH 1/1 notes: document behavior of --ref and --notes DWIMery
From: Jacob Keller <[email protected]>
The --notes and --ref parameter for selecting which notes ref to operate on are based off of expand_notes_ref functionality. The documentation mentioned that an unqualified ref argument would be taken as under refs/notes/. However, this does not clearly indicate that refs/heads/master will expand to refs/notes/refs/heads/master, so document this behavior.
Add a further test for the expected behavior of git notes --ref refs/heads/master get-ref as well, to ensure future patches do not break this assumption.
--- Documentation/git-notes.txt | 4 +++- Documentation/pretty-options.txt | 5 +++-- t/t3301-notes.sh | 6 ++++++ 3 files changed, 12 insertions(+), 3 deletions(-)
Documentation/git-notes.txt +3 -1
@@ -162,7 +162,9 @@ OPTIONS --ref <ref>:: Manipulate the notes tree in <ref>. This overrides 'GIT_NOTES_REF' and the "core.notesRef" configuration. The ref - is taken to be in `refs/notes/` if it is not qualified. + is taken to be in `refs/notes/` even if it is qualified under some + other location; in other words, `refs/heads/master` will be expanded + to `refs/notes/refs/heads/master`. --ignore-missing:: Do not consider it an error to request removing notes from an
Documentation/pretty-options.txt +3 -2
@@ -55,8 +55,9 @@ By default, the notes shown are from the notes refs listed in the environment overrides). See linkgit:git-config[1] for more details. + With an optional '<ref>' argument, show this notes ref instead of the -default notes ref(s). The ref is taken to be in `refs/notes/` if it -is not qualified. +default notes ref(s). The ref is taken to be in `refs/notes/` even if it is +qualified under some other location; in other words, `refs/heads/master` +will be expanded to `refs/notes/refs/heads/master`. + Multiple --notes options can be combined to control which notes are being displayed. Examples: "--notes=foo" will show only notes from
t/t3301-notes.sh +6 -0
@@ -1132,6 +1132,12 @@ test_expect_success 'git notes copy diagnoses too many or too few parameters' ' test_must_fail git notes copy one two three ' +test_expect_success 'git notes get-ref expands refs/heads/master to refs/notes/refs/heads/master' ' + test_unconfig core.notesRef && + sane_unset GIT_NOTES_REF && + test "$(git notes --ref=refs/heads/master get-ref)" = "refs/notes/refs/heads/master" +' + test_expect_success 'git notes get-ref (no overrides)' ' test_unconfig core.notesRef && sane_unset GIT_NOTES_REF &&
Signature · 1 line
2.6.0.rc3.238.gc07a1e8
Quoted 9 lines · Jacob Keller
From: Jacob Keller <[email protected]>
The --notes and --ref parameter for selecting which notes ref to operate on are based off of
expand_notes_reffunctionality. The documentation mentioned that an unqualified ref argument would be taken as underrefs/notes/. However, this does not clearly indicate thatrefs/heads/masterwill expand torefs/notes/refs/heads/master, so document this behavior.
Quoted 6 lines
Add a further test for the expected behavior of git notes --ref refs/heads/master get-ref as well, to ensure future patches do not break this assumption.
Signed-off-by Jacob Keller <[email protected]>---
Looks OK to a cursory read, but I find "even if it is qualified under some other location" a bit tiring to read without adding much value. To readers who consider "other" in that phrase to be clear enough (i.e. "location other than refs/notes"), it is totally redundant. To other readers who feel "other" in that phrase to be under qualified (i.e. "location other than what???"), it is not informative enough. Middle-ground readers who would not know if "refs/a" is inside or outside some "other" location, it is confusing.
After all, "a/b" is qualified under some location (i.e. a/) other than "refs/notes/", and it does mean "refs/notes/a/b".
How about phrasing it totally differently?
The ref specifies the full refname when it begins with refs/notes/; otherwise ref/notes/ is prefixed to form a full name of the ref.
I think that would remove the need to illustrate with concrete examples like refs/heads/blah.
Quoted 34 lines · Junio C Hamano
Quoted 12 lines · Jacob Keller
From: Jacob Keller <[email protected]>
The --notes and --ref parameter for selecting which notes ref to operate
on are based off ofexpand_notes_reffunctionality. The documentation
mentioned that an unqualified ref argument would be taken as underrefs/notes/. However, this does not clearly indicate thatrefs/heads/masterwill expand torefs/notes/refs/heads/master, so
document this behavior.Quoted 7 lines
Add a further test for the expected behavior of git notes --ref refs/heads/master get-ref as well, to ensure future patches do not break
this assumption.Signed-off-by Jacob Keller <[email protected]>---
Looks OK to a cursory read, but I find "even if it is qualified under some other location" a bit tiring to read without adding much value. To readers who consider "other" in that phrase to be clear enough (i.e. "location other than refs/notes"), it is totally redundant. To other readers who feel "other" in that phrase to be under qualified (i.e. "location other than what???"), it is not informative enough. Middle-ground readers who would not know if "refs/a" is inside or outside some "other" location, it is confusing.
After all, "a/b" is qualified under some location (i.e. a/) other than "refs/notes/", and it does mean "refs/notes/a/b".
Quoted 9 lines
How about phrasing it totally differently?
The ref specifies the full refname when it begins with
refs/notes/; otherwiseref/notes/is prefixed to form a full name of the ref.I think that would remove the need to illustrate with concrete examples like refs/heads/blah.
Yes, let's go with that.
Regards,
Jake
Quoted 9 lines · Junio C Hamano
How about phrasing it totally differently?
The ref specifies the full refname when it begins with
refs/notes/; otherwiseref/notes/is prefixed to form a full name of the ref.I think that would remove the need to illustrate with concrete examples like refs/heads/blah.
Wait, what about the DWIM of notes/<name> goes to refs/notes/<name>.. do we need to explain that here? it might seem that "notes/foo" ends up as "refs/notes/notes/foo" which is not really what we mean.
Regards,
Jake
Quoted 7 lines · Jacob E
Quoted 6 lines · Junio C Hamano
How about phrasing it totally differently?
The ref specifies the full refname when it begins with
refs/notes/; otherwiseref/notes/is prefixed to form a full name of the ref.
Quoted 6 lines
Quoted 3 lines
I think that would remove the need to illustrate with concrete examples like refs/heads/blah.
Wait, what about the DWIM of notes/<name> goes to refs/notes/<name>.. do we need to explain that here?
Yeah, throw that in, too.
... when it begins with refs/notes/; when it begins with notes/, refs/ and otherwise refs/notes/ is prefixed to form a full name of the ref.
We could emphasize the end result by ending the sentence like so:
... form a full name of the ref that is under refs/notes/.
if you wanted to. I am neutral (I do not think it would hurt, but I do not think it adds much clarity).
Thanks.