diff options
Diffstat (limited to 'notes.c')
-rw-r--r-- | notes.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -1283,10 +1283,8 @@ static void format_note(struct notes_tree *t, const struct object_id *object_oid if (!ref || !strcmp(ref, GIT_NOTES_DEFAULT_REF)) { strbuf_addstr(sb, "\nNotes:\n"); } else { - if (starts_with(ref, "refs/")) - ref += 5; - if (starts_with(ref, "notes/")) - ref += 6; + skip_prefix(ref, "refs/", &ref); + skip_prefix(ref, "notes/", &ref); strbuf_addf(sb, "\nNotes (%s):\n", ref); } } @@ -1336,9 +1334,9 @@ void expand_notes_ref(struct strbuf *sb) if (starts_with(sb->buf, "refs/notes/")) return; /* we're happy */ else if (starts_with(sb->buf, "notes/")) - strbuf_insert(sb, 0, "refs/", 5); + strbuf_insertstr(sb, 0, "refs/"); else - strbuf_insert(sb, 0, "refs/notes/", 11); + strbuf_insertstr(sb, 0, "refs/notes/"); } void expand_loose_notes_ref(struct strbuf *sb) |