Skip to content

Commit f4892a3

Browse files
committed
Merge branch 'jk/notes-dwim-doc' into maint
The way how --ref/--notes to specify the notes tree reference are DWIMmed was not clearly documented. * jk/notes-dwim-doc: notes: correct documentation of DWIMery for notes references
2 parents 47c566a + e14c92e commit f4892a3

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

Documentation/git-notes.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ OPTIONS
162162
--ref <ref>::
163163
Manipulate the notes tree in <ref>. This overrides
164164
'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.
166168

167169
--ignore-missing::
168170
Do not consider it an error to request removing notes from an

Documentation/pretty-options.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ By default, the notes shown are from the notes refs listed in the
5555
environment overrides). See linkgit:git-config[1] for more details.
5656
+
5757
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.
6061
+
6162
Multiple --notes options can be combined to control which notes are
6263
being displayed. Examples: "--notes=foo" will show only notes from

t/t3301-notes.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,12 @@ test_expect_success 'git notes copy diagnoses too many or too few parameters' '
11221122
test_must_fail git notes copy one two three
11231123
'
11241124

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+
11251131
test_expect_success 'git notes get-ref (no overrides)' '
11261132
test_unconfig core.notesRef &&
11271133
sane_unset GIT_NOTES_REF &&

0 commit comments

Comments
 (0)