From: W. Trevor King Date: Wed, 05 Sep 2012 12:52:45 GMT Subject: [PATCH 2/2] notes: don't alter refs starting with 'refs/' in expand_notes_ref Message-ID: <8c65d450f545ad3f6a241ef1b95fca272ec3a38a.1346849556.git.wking@tremily.us> In-Reply-To: From: "W. Trevor King" 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 --- 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