Skip to content

Commit e082a85

Browse files
committed
Merge branch 'na/notes-displayref-is-not-boolean'
Config parser fix for "git notes". * na/notes-displayref-is-not-boolean: t3301: test proper exit response to no-value notes.displayRef. notes.c: fix a segfault in notes_display_config()
2 parents b94b1f9 + 45fef15 commit e082a85

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

notes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ static int notes_display_config(const char *k, const char *v, void *cb)
970970

971971
if (*load_refs && !strcmp(k, "notes.displayref")) {
972972
if (!v)
973-
config_error_nonbool(k);
973+
return config_error_nonbool(k);
974974
string_list_add_refs_by_glob(&display_notes_refs, v);
975975
}
976976

t/t3301-notes.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,11 @@ test_expect_success 'notes.displayRef respects order' '
672672
test_cmp expect-both-reversed actual
673673
'
674674

675+
test_expect_success 'notes.displayRef with no value handled gracefully' '
676+
test_must_fail git -c notes.displayRef log -0 --notes &&
677+
test_must_fail git -c notes.displayRef diff-tree --notes HEAD
678+
'
679+
675680
test_expect_success 'GIT_NOTES_DISPLAY_REF works' '
676681
GIT_NOTES_DISPLAY_REF=refs/notes/commits:refs/notes/other \
677682
git log -2 >actual &&

0 commit comments

Comments
 (0)