Imported Upstream version 2.13.3
[platform/upstream/git.git] / notes-utils.c
index 299e34b..8f9ad7d 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);
@@ -132,8 +132,11 @@ struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd)
                c->mode_from_env = 1;
                c->combine = parse_combine_notes_fn(rewrite_mode_env);
                if (!c->combine)
-                       /* TRANSLATORS: The first %s is the name of the
-                          environment variable, the second %s is its value */
+                       /*
+                        * TRANSLATORS: The first %s is the name of
+                        * the environment variable, the second %s is
+                        * its value.
+                        */
                        error(_("Bad %s value: '%s'"), GIT_NOTES_REWRITE_MODE_ENVIRONMENT,
                                        rewrite_mode_env);
        }
@@ -148,7 +151,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;