From: Johan Herland Date: Sun, 17 Jan 2010 21:04:20 GMT Subject: [PATCHv11 03/20] Add tests for checking correct handling of $GIT_NOTES_REF and core.notesRef Message-ID: <1263762277-31419-4-git-send-email-johan@herland.net> In-Reply-To: <1263762277-31419-1-git-send-email-johan@herland.net> Signed-off-by: Johan Herland --- t/t3301-notes.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-) diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh index 1e34f48..3985d2a 100755 --- a/t/t3301-notes.sh +++ b/t/t3301-notes.sh @@ -147,4 +147,52 @@ test_expect_success 'show -m and -F notes' ' test_cmp expect-m-and-F output ' +test_expect_success 'create other note on a different notes ref (setup)' ' + : > a5 && + git add a5 && + test_tick && + git commit -m 5th && + GIT_NOTES_REF="refs/notes/other" git notes edit -m "other note" +' + +cat > expect-other << EOF +commit bd1753200303d0a0344be813e504253b3d98e74d +Author: A U Thor +Date: Thu Apr 7 15:17:13 2005 -0700 + + 5th + +Notes: + other note +EOF + +cat > expect-not-other << EOF +commit bd1753200303d0a0344be813e504253b3d98e74d +Author: A U Thor +Date: Thu Apr 7 15:17:13 2005 -0700 + + 5th +EOF + +test_expect_success 'Do not show note on other ref by default' ' + git log -1 > output && + test_cmp expect-not-other output +' + +test_expect_success 'Do show note when ref is given in GIT_NOTES_REF' ' + GIT_NOTES_REF="refs/notes/other" git log -1 > output && + test_cmp expect-other output +' + +test_expect_success 'Do show note when ref is given in core.notesRef config' ' + git config core.notesRef "refs/notes/other" && + git log -1 > output && + test_cmp expect-other output +' + +test_expect_success 'Do not show note when core.notesRef is overridden' ' + GIT_NOTES_REF="refs/notes/wrong" git log -1 > output && + test_cmp expect-not-other output +' + test_done -- 1.6.6.rc1.321.g0496e