notes: correct documentation of DWIMery for notes references
authorJacob Keller <jacob.keller@gmail.com>
Tue, 22 Sep 2015 22:15:03 +0000 (15:15 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 22 Sep 2015 22:24:01 +0000 (15:24 -0700)
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>
Documentation/git-notes.txt
Documentation/pretty-options.txt
t/t3301-notes.sh
index 851518d531b53966dc6dca1321c71e8381f50e7b..b8889ecf1c963bda1da8faf4439b75cc6a1d48a5 100644 (file)
@@ -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.
+       specifies the full refname 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.
 
 --ignore-missing::
        Do not consider it an error to request removing notes from an
index 8d6c5cec4c5edc904a5f2d7595fd8943457f550d..4b659ac1a6a6c1b57d0cadc5cd69ce6b69525cc1 100644 (file)
@@ -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 specifies the full refname 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.
 +
 Multiple --notes options can be combined to control which notes are
 being displayed. Examples: "--notes=foo" will show only notes from
index 8cffd35fb03d7ca5abbd1a229c6c8533f8c5e917..cd70274ea51ac5c5ba6669495b944da5b7b97431 100755 (executable)
@@ -1122,6 +1122,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 &&