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>
Johan Herland committed
Feb 13, 2010 at 22:28 UTC
3b78cdbe693092a58d9724deb14bd7be0dd4d7b3
1 file changed
+48
t/t3301-notes.sh
+48
@@ -206,4 +206,52 @@ do
206
'
207
done
208
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 <author@example.com>
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 <author@example.com>
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
+
257
test_done