| 44 | } |
| 45 | |
| 46 | void commit_notes(struct repository *r, struct notes_tree *t, const char *msg) |
| 47 | { |
| 48 | struct strbuf buf = STRBUF_INIT; |
| 49 | struct object_id commit_oid; |
| 50 | |
| 51 | if (!t) |
| 52 | t = &default_notes_tree; |
| 53 | if (!t->initialized || !t->update_ref || !*t->update_ref) |
| 54 | die(_("Cannot commit uninitialized/unreferenced notes tree")); |
| 55 | if (!t->dirty) |
| 56 | return; /* don't have to commit an unchanged tree */ |
| 57 | |
| 58 | /* Prepare commit message and reflog message */ |
| 59 | strbuf_addstr(&buf, msg); |
| 60 | strbuf_complete_line(&buf); |
| 61 | |
| 62 | create_notes_commit(r, t, NULL, buf.buf, buf.len, &commit_oid); |
| 63 | strbuf_insertstr(&buf, 0, "notes: "); |
| 64 | refs_update_ref(get_main_ref_store(the_repository), buf.buf, |
| 65 | t->update_ref, &commit_oid, NULL, 0, |
| 66 | UPDATE_REFS_DIE_ON_ERR); |
| 67 | |
| 68 | strbuf_release(&buf); |
| 69 | } |
| 70 | |
| 71 | int parse_notes_merge_strategy(const char *v, enum notes_merge_strategy *s) |
| 72 | { |
no test coverage detected