From: "W. Trevor King" <redacted>
This avoids surprising cases like:
$ GIT_NOTES_REF=refs/remotes/origin/notes/commits git notes get-ref --expand
refs/notes/refs/remotes/origin/notes/commits
With the old implementation, all note refs had to live under
'refs/notes/' which was not mentioned in the git-notes.txt.
Signed-off-by: W. Trevor King <redacted>
---
notes.c | 2 +-
t/t3301-notes.sh | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/notes.c b/notes.c
index 93e9868..60394c8 100644
--- a/notes.c
+++ b/notes.c
@@ -1289,7 +1289,7 @@ int copy_note(struct notes_tree *t,
void expand_notes_ref(struct strbuf *sb)
{
- if (!prefixcmp(sb->buf, "refs/notes/"))
+ if (!prefixcmp(sb->buf, "refs/"))
return; /* we're happy */
else if (!prefixcmp(sb->buf, "notes/"))
strbuf_insert(sb, 0, "refs/", 5);diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index c0486a0..707d7e6 100755
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -1230,4 +1230,8 @@ test_expect_success 'git notes get-ref (--expand)' '
test "$(GIT_NOTES_REF=commits git notes get-ref --expand)" = "refs/notes/commits"
'
+test_expect_success 'git notes get-ref (--expand)' '
+ test "$(GIT_NOTES_REF=refs/remotes/origin/notes/commits git notes get-ref --expand)" = "refs/remotes/origin/notes/commits"
+'
+
test_done
--
1.7.12.176.g3fc0e4c.dirty