diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-01-20 11:43:21 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-01-20 11:43:21 -0800 |
commit | b4e8e0ed2deb552ca17206c9c1c2fb099e5df97a (patch) | |
tree | f37be1fcf9c09642123fe7333f1d5c02a79d62c7 /t/t3301-notes.sh | |
parent | Sync with maint (diff) | |
parent | notes: allow treeish expressions as notes ref (diff) | |
download | tgif-b4e8e0ed2deb552ca17206c9c1c2fb099e5df97a.tar.xz |
Merge branch 'mh/notes-allow-reading-treeish'
Some "git notes" operations, e.g. "git log --notes=<note>", should
be able to read notes from any tree-ish that is shaped like a notes
tree, but the notes infrastructure required that the argument must
be a ref under refs/notes/. Loosen it to require a valid ref only
when the operation would update the notes (in which case we must
have a place to store the updated notes tree, iow, a ref).
* mh/notes-allow-reading-treeish:
notes: allow treeish expressions as notes ref
Diffstat (limited to 't/t3301-notes.sh')
-rwxr-xr-x | t/t3301-notes.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index cd70274ea5..2d200fdf36 100755 --- a/t/t3301-notes.sh +++ b/t/t3301-notes.sh @@ -83,6 +83,16 @@ test_expect_success 'edit existing notes' ' test_must_fail git notes show HEAD^ ' +test_expect_success 'show notes from treeish' ' + test "b3" = "$(git notes --ref commits^{tree} show)" && + test "b4" = "$(git notes --ref commits@{1} show)" +' + +test_expect_success 'cannot edit notes from non-ref' ' + test_must_fail git notes --ref commits^{tree} edit && + test_must_fail git notes --ref commits@{1} edit +' + test_expect_success 'cannot "git notes add -m" where notes already exists' ' test_must_fail git notes add -m "b2" && test_path_is_missing .git/NOTES_EDITMSG && |