summaryrefslogtreecommitdiff
path: root/t/t3301-notes.sh
diff options
context:
space:
mode:
authorJohan Herland <johan@herland.net>2010-02-13 21:28:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-02-14 03:36:11 (GMT)
commit3b78cdbe693092a58d9724deb14bd7be0dd4d7b3 (patch)
tree63737c23bbe476def76d6174c968359971d33782 /t/t3301-notes.sh
parenta7e7eff66206829f7752c565198dbe6f40ef72a0 (diff)
downloadgit-3b78cdbe693092a58d9724deb14bd7be0dd4d7b3.zip
git-3b78cdbe693092a58d9724deb14bd7be0dd4d7b3.tar.gz
git-3b78cdbe693092a58d9724deb14bd7be0dd4d7b3.tar.bz2
Add tests for checking correct handling of $GIT_NOTES_REF and core.notesRef
Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3301-notes.sh')
-rwxr-xr-xt/t3301-notes.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index 5d9604b..18aad53 100755
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -206,4 +206,52 @@ do
'
done
+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 <author@example.com>
+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 <author@example.com>
+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