notes: track whether notes_trees were changed at all
[gitweb.git] / builtin-notes.c
index 2e45be9de7ba561f421e82516144ba6f182c5e99..e5046b98ed1bd086457562fd21d494259c765f45 100644 (file)
@@ -249,6 +249,8 @@ int commit_notes(struct notes_tree *t, const char *msg)
                t = &default_notes_tree;
        if (!t->initialized || !t->ref || !*t->ref)
                die("Cannot commit uninitialized/unreferenced notes tree");
+       if (!t->dirty)
+               return 0; /* don't have to commit an unchanged tree */
 
        /* Prepare commit message and reflog message */
        strbuf_addstr(&buf, "notes: "); /* commit message starts at index 7 */