notes: correct documentation of DWIMery for notes references

expand_notes_ref is used by --ref from git-notes(1) and --notes from the git log to find the full refname of a notes reference. Previously the documentation of these options was not clear about what sorts of expansions would be performed. Fix the documentation to clearly and accurately describe the behavior of the expansions. Add a test for this expansion when using git notes get-ref in order to prevent future patches from changing this behavior. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jacob Keller committed Sep 22, 2015 at 15:15 UTC e14c92e841fd6d99c8c17af05a411a85ac212254
3 files changed +12 -3
Documentation/git-notes.txt
+3 -1
@@ -162,7 +162,9 @@ OPTIONS
162 --ref <ref>::
163 Manipulate the notes tree in <ref>. This overrides
164 'GIT_NOTES_REF' and the "core.notesRef" configuration. The ref
165 - is taken to be in `refs/notes/` if it is not qualified.
165 + specifies the full refname when it begins with `refs/notes/`; when it
166 + begins with `notes/`, `refs/` and otherwise `refs/notes/` is prefixed
167 + to form a full name of the ref.
168
169 --ignore-missing::
170 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
55 environment overrides). See linkgit:git-config[1] for more details.
56 +
57 With an optional '<ref>' argument, show this notes ref instead of the
58 -default notes ref(s). The ref is taken to be in `refs/notes/` if it
59 -is not qualified.
58 +default notes ref(s). The ref specifies the full refname when it begins
59 +with `refs/notes/`; when it begins with `notes/`, `refs/` and otherwise
60 +`refs/notes/` is prefixed to form a full name of the ref.
61 +
62 Multiple --notes options can be combined to control which notes are
63 being displayed. Examples: "--notes=foo" will show only notes from
t/t3301-notes.sh
+6
@@ -1122,6 +1122,12 @@ test_expect_success 'git notes copy diagnoses too many or too few parameters' '
1122 test_must_fail git notes copy one two three
1123 '
1124
1125 +test_expect_success 'git notes get-ref expands refs/heads/master to refs/notes/refs/heads/master' '
1126 + test_unconfig core.notesRef &&
1127 + sane_unset GIT_NOTES_REF &&
1128 + test "$(git notes --ref=refs/heads/master get-ref)" = "refs/notes/refs/heads/master"
1129 +'
1130 +
1131 test_expect_success 'git notes get-ref (no overrides)' '
1132 test_unconfig core.notesRef &&
1133 sane_unset GIT_NOTES_REF &&