]> rtime.felk.cvut.cz Git - git.git/blobdiff - notes.c
add-interactive: Clarify “remaining hunks in the file”
[git.git] / notes.c
diff --git a/notes.c b/notes.c
index 2feeb7bb06ce5073d6813e447f13f1205e2d87c4..e425e198278bfb5c6a039dc88825568f1518e875 100644 (file)
--- a/notes.c
+++ b/notes.c
@@ -629,8 +629,8 @@ static void write_tree_entry(struct strbuf *buf, unsigned int mode,
                const char *path, unsigned int path_len, const
                unsigned char *sha1)
 {
-               strbuf_addf(buf, "%06o %.*s%c", mode, path_len, path, '\0');
-               strbuf_add(buf, sha1, 20);
+       strbuf_addf(buf, "%o %.*s%c", mode, path_len, path, '\0');
+       strbuf_add(buf, sha1, 20);
 }
 
 static void tree_write_stack_init_subtree(struct tree_write_stack *tws,
@@ -933,6 +933,7 @@ void init_notes(struct notes_tree *t, const char *notes_ref,
        t->ref = notes_ref ? xstrdup(notes_ref) : NULL;
        t->combine_notes = combine_notes;
        t->initialized = 1;
+       t->dirty = 0;
 
        if (flags & NOTES_INIT_EMPTY || !notes_ref ||
            read_ref(notes_ref, object_sha1))
@@ -1011,6 +1012,7 @@ void add_note(struct notes_tree *t, const unsigned char *object_sha1,
        if (!t)
                t = &default_notes_tree;
        assert(t->initialized);
+       t->dirty = 1;
        if (!combine_notes)
                combine_notes = t->combine_notes;
        l = (struct leaf_node *) xmalloc(sizeof(struct leaf_node));
@@ -1026,9 +1028,10 @@ void remove_note(struct notes_tree *t, const unsigned char *object_sha1)
        if (!t)
                t = &default_notes_tree;
        assert(t->initialized);
+       t->dirty = 1;
        hashcpy(l.key_sha1, object_sha1);
        hashclr(l.val_sha1);
-       return note_tree_remove(t, t->root, 0, &l);
+       note_tree_remove(t, t->root, 0, &l);
 }
 
 const unsigned char *get_note(struct notes_tree *t,