summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2023-04-22 09:55:43 -0400
committerJunio C Hamano <gitster@pobox.com>2023-04-24 11:09:13 -0700
commitae6f064fd7f0925cc8985769750a1367a4c24194 (patch)
treee202f02d7e40bd369d63a608330955422112b767 /commit.c
parent7580f92ffa970b9484ac214f7b53cec5e26ca4bc (diff)
notes: clean up confusing NULL checks in init_notes()
Coverity complains that we check whether "notes_ref" is NULL, but it was already implied to be non-NULL earlier in the function. And this is true; since b9342b3fd63 (refs: add array of ref namespaces, 2022-08-05), we call xstrdup(notes_ref) unconditionally, which would segfault if it was NULL. But that commit is actually doing the right thing. Even if NULL is passed into the function, we'll use default_notes_ref() as a fallback, which will never return NULL (it tries a few options, but its last resort is a string literal). Ironically, the "!notes_ref" check was added by the same commit that added the fallback: 709f79b0894 (Notes API: init_notes(): Initialize the notes tree from the given notes ref, 2010-02-13). So this check never did anything. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions