Skip to content

Commit 3b78cdb

Browse files
jherlandgitster
authored andcommitted
Add tests for checking correct handling of $GIT_NOTES_REF and core.notesRef
Signed-off-by: Johan Herland <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a7e7eff commit 3b78cdb

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

t/t3301-notes.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,52 @@ do
206206
'
207207
done
208208

209+
test_expect_success 'create other note on a different notes ref (setup)' '
210+
: > a5 &&
211+
git add a5 &&
212+
test_tick &&
213+
git commit -m 5th &&
214+
GIT_NOTES_REF="refs/notes/other" git notes edit -m "other note"
215+
'
216+
217+
cat > expect-other << EOF
218+
commit bd1753200303d0a0344be813e504253b3d98e74d
219+
Author: A U Thor <[email protected]>
220+
Date: Thu Apr 7 15:17:13 2005 -0700
221+
222+
5th
223+
224+
Notes:
225+
other note
226+
EOF
227+
228+
cat > expect-not-other << EOF
229+
commit bd1753200303d0a0344be813e504253b3d98e74d
230+
Author: A U Thor <[email protected]>
231+
Date: Thu Apr 7 15:17:13 2005 -0700
232+
233+
5th
234+
EOF
235+
236+
test_expect_success 'Do not show note on other ref by default' '
237+
git log -1 > output &&
238+
test_cmp expect-not-other output
239+
'
240+
241+
test_expect_success 'Do show note when ref is given in GIT_NOTES_REF' '
242+
GIT_NOTES_REF="refs/notes/other" git log -1 > output &&
243+
test_cmp expect-other output
244+
'
245+
246+
test_expect_success 'Do show note when ref is given in core.notesRef config' '
247+
git config core.notesRef "refs/notes/other" &&
248+
git log -1 > output &&
249+
test_cmp expect-other output
250+
'
251+
252+
test_expect_success 'Do not show note when core.notesRef is overridden' '
253+
GIT_NOTES_REF="refs/notes/wrong" git log -1 > output &&
254+
test_cmp expect-not-other output
255+
'
256+
209257
test_done

0 commit comments

Comments
 (0)