diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-01-20 11:43:21 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-01-20 11:43:21 -0800 |
commit | b4e8e0ed2deb552ca17206c9c1c2fb099e5df97a (patch) | |
tree | f37be1fcf9c09642123fe7333f1d5c02a79d62c7 /notes-utils.c | |
parent | Sync with maint (diff) | |
parent | notes: allow treeish expressions as notes ref (diff) | |
download | tgif-b4e8e0ed2deb552ca17206c9c1c2fb099e5df97a.tar.xz |
Merge branch 'mh/notes-allow-reading-treeish'
Some "git notes" operations, e.g. "git log --notes=<note>", should
be able to read notes from any tree-ish that is shaped like a notes
tree, but the notes infrastructure required that the argument must
be a ref under refs/notes/. Loosen it to require a valid ref only
when the operation would update the notes (in which case we must
have a place to store the updated notes tree, iow, a ref).
* mh/notes-allow-reading-treeish:
notes: allow treeish expressions as notes ref
Diffstat (limited to 'notes-utils.c')
-rw-r--r-- | notes-utils.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/notes-utils.c b/notes-utils.c index 299e34bccc..24a33616a4 100644 --- a/notes-utils.c +++ b/notes-utils.c @@ -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; |