Skip to content

Commit 02125bc

Browse files
committed
Merge branch 'mg/notes-reflog'
* mg/notes-reflog: refs.c: Write reflogs for notes just like for branch heads t3301-notes: Test the creation of reflog entries
2 parents d6b5af6 + b2e256b commit 02125bc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ test_expect_success 'create notes' '
6565
test_must_fail git notes show HEAD^
6666
'
6767

68+
cat >expect <<EOF
69+
d423f8c refs/notes/commits@{0}: notes: Notes added by 'git notes add'
70+
EOF
71+
72+
test_expect_success 'create reflog entry' '
73+
git reflog show refs/notes/commits >output &&
74+
test_cmp expect output
75+
'
76+
6877
test_expect_success 'edit existing notes' '
6978
MSG=b3 git notes edit &&
7079
test ! -f .git/NOTES_EDITMSG &&

0 commit comments

Comments
 (0)