Skip to content

Commit b2e256b

Browse files
Michael J Grubergitster
authored andcommitted
refs.c: Write reflogs for notes just like for branch heads
The notes code intends to write reflog entries, but currently they are not written because log_ref_write() checks for the refname path explicitly. Add refs/notes to the list of allowed paths so that notes references are treated just like branch heads, i.e. according to core.logAllRefUpdates and core.bare. Signed-off-by: Michael J Gruber <[email protected]> Acked-by: Johan Herland <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4d80fa8 commit b2e256b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

refs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,7 @@ static int log_ref_write(const char *ref_name, const unsigned char *old_sha1,
12761276
if (log_all_ref_updates &&
12771277
(!prefixcmp(ref_name, "refs/heads/") ||
12781278
!prefixcmp(ref_name, "refs/remotes/") ||
1279+
!prefixcmp(ref_name, "refs/notes/") ||
12791280
!strcmp(ref_name, "HEAD"))) {
12801281
if (safe_create_leading_directories(log_file) < 0)
12811282
return error("unable to create directory for %s",

t/t3301-notes.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ cat >expect <<EOF
6969
d423f8c refs/notes/commits@{0}: notes: Notes added by 'git notes add'
7070
EOF
7171

72-
test_expect_failure 'create reflog entry' '
72+
test_expect_success 'create reflog entry' '
7373
git reflog show refs/notes/commits >output &&
7474
test_cmp expect output
7575
'

0 commit comments

Comments
 (0)