sha1_file_name(): declare to return a const string
[gitweb.git] / notes.c
diff --git a/notes.c b/notes.c
index fa7cdf7dd2eadcd757936f6eab50caa6fd92fb8b..5f07c0b7f28e09bd2f7969ea08b00b319a226920 100644 (file)
--- a/notes.c
+++ b/notes.c
@@ -927,8 +927,12 @@ static int string_list_add_one_ref(const char *refname, const unsigned char *sha
        return 0;
 }
 
+/*
+ * The list argument must have strdup_strings set on it.
+ */
 void string_list_add_refs_by_glob(struct string_list *list, const char *glob)
 {
+       assert(list->strdup_strings);
        if (has_glob_specials(glob)) {
                for_each_glob_ref(string_list_add_one_ref, glob, list);
        } else {
@@ -1239,9 +1243,9 @@ static void format_note(struct notes_tree *t, const unsigned char *object_sha1,
                if (!ref || !strcmp(ref, GIT_NOTES_DEFAULT_REF)) {
                        strbuf_addstr(sb, "\nNotes:\n");
                } else {
-                       if (!prefixcmp(ref, "refs/"))
+                       if (starts_with(ref, "refs/"))
                                ref += 5;
-                       if (!prefixcmp(ref, "notes/"))
+                       if (starts_with(ref, "notes/"))
                                ref += 6;
                        strbuf_addf(sb, "\nNotes (%s):\n", ref);
                }
@@ -1289,9 +1293,9 @@ int copy_note(struct notes_tree *t,
 
 void expand_notes_ref(struct strbuf *sb)
 {
-       if (!prefixcmp(sb->buf, "refs/notes/"))
+       if (starts_with(sb->buf, "refs/notes/"))
                return; /* we're happy */
-       else if (!prefixcmp(sb->buf, "notes/"))
+       else if (starts_with(sb->buf, "notes/"))
                strbuf_insert(sb, 0, "refs/", 5);
        else
                strbuf_insert(sb, 0, "refs/notes/", 11);