remote: actually check if remote exits
[gitweb.git] / notes-utils.c
index 299e34bccc5893529cb5db1abe061529304e6074..24a33616a47737e6ae8cf917080cbb314dcf2762 100644 (file)
@@ -37,7 +37,7 @@ void commit_notes(struct notes_tree *t, const char *msg)
 
        if (!t)
                t = &default_notes_tree;
-       if (!t->initialized || !t->ref || !*t->ref)
+       if (!t->initialized || !t->update_ref || !*t->update_ref)
                die(_("Cannot commit uninitialized/unreferenced notes tree"));
        if (!t->dirty)
                return; /* don't have to commit an unchanged tree */
@@ -48,7 +48,7 @@ void commit_notes(struct notes_tree *t, const char *msg)
 
        create_notes_commit(t, NULL, buf.buf, buf.len, commit_sha1);
        strbuf_insert(&buf, 0, "notes: ", 7); /* commit message starts at index 7 */
-       update_ref(buf.buf, t->ref, commit_sha1, NULL, 0,
+       update_ref(buf.buf, t->update_ref, commit_sha1, NULL, 0,
                   UPDATE_REFS_DIE_ON_ERR);
 
        strbuf_release(&buf);
@@ -148,7 +148,7 @@ struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd)
                free(c);
                return NULL;
        }
-       c->trees = load_notes_trees(c->refs);
+       c->trees = load_notes_trees(c->refs, NOTES_INIT_WRITABLE);
        string_list_clear(c->refs, 0);
        free(c->refs);
        return c;