Daniel Serodio
Daniel Serodio

Reputation: 4516

`git log` shows notes that `git notes` doesn't

I'm using stepup to manage git notes that are used to automate version numbering and release notes.

The notes in one of our repos seem to be messed up:

$ git log HEAD

commit 04c85f5ad7e5d60de8c9f0b8e08681e833751909
Author: Daniel Serodio <[email protected]>
Date:   Wed Oct 29 15:47:55 2014 -0200

    non-deps removed

Notes (added):
    splittest beta

However:

$ git notes show HEAD

error: No note found for object 04c85f5ad7e5d60de8c9f0b8e08681e833751909.

Does anyone have a clue about the cause and/or the fix for this?

Upvotes: 1

Views: 700

Answers (2)

VonC
VonC

Reputation: 1326746

git log respects the configuration entry notes.displayRef

Indeed. Make sure to not set it to an empty value in your test, or it would segfault (before Git 2.30 (Q1 2021))

The Config parser has been fixed for git notes.

See commit 45fef15, commit c3eb95a (22 Nov 2020) by Nate Avers (nateavers).
(Merged by Junio C Hamano -- gitster -- in commit e082a85, 30 Nov 2020)

notes.c: fix a segfault in notes_display_config()

Signed-off-by: Nate Avers

If notes.displayRef is configured with no value[1], control should be returned to the caller when notes.c:notes_display_config() checks if 'v' is NULL.
Otherwise, both git log --notes(man) and git diff-tree --notes(man) will subsequently segfault when refs.h:has_glob_specials() calls strpbrk() with a NULL first argument.

[1] Examples:

.git/config:
[notes]
  displayRef

$ git -c notes.displayRef [...]

Upvotes: 0

Andrew C
Andrew C

Reputation: 14863

git log respects the configuration entry notes.displayRef which I am guessing you have to set to either '*' or 'added'

To make git notes show it try

git notes --ref=added show HEAD

Upvotes: 4

Related Questions