]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/notes.c
reftable: signal overflow
[thirdparty/git.git] / builtin / notes.c
index 71c59583a17f8da6eb948248e19a262781091f28..118db9e455d3e61403d54931bd41ad0332693204 100644 (file)
@@ -134,14 +134,13 @@ static void copy_obj_to_fd(int fd, const struct object_id *oid)
 
 static void write_commented_object(int fd, const struct object_id *object)
 {
-       const char *show_args[5] =
-               {"show", "--stat", "--no-notes", oid_to_hex(object), NULL};
        struct child_process show = CHILD_PROCESS_INIT;
        struct strbuf buf = STRBUF_INIT;
        struct strbuf cbuf = STRBUF_INIT;
 
        /* Invoke "git show --stat --no-notes $object" */
-       show.argv = show_args;
+       strvec_pushl(&show.args, "show", "--stat", "--no-notes",
+                    oid_to_hex(object), NULL);
        show.no_stdin = 1;
        show.out = -1;
        show.err = 0;
@@ -861,15 +860,19 @@ static int merge(int argc, const char **argv, const char *prefix)
                update_ref(msg.buf, default_notes_ref(), &result_oid, NULL, 0,
                           UPDATE_REFS_DIE_ON_ERR);
        else { /* Merge has unresolved conflicts */
+               struct worktree **worktrees;
                const struct worktree *wt;
                /* Update .git/NOTES_MERGE_PARTIAL with partial merge result */
                update_ref(msg.buf, "NOTES_MERGE_PARTIAL", &result_oid, NULL,
                           0, UPDATE_REFS_DIE_ON_ERR);
                /* Store ref-to-be-updated into .git/NOTES_MERGE_REF */
-               wt = find_shared_symref("NOTES_MERGE_REF", default_notes_ref());
+               worktrees = get_worktrees();
+               wt = find_shared_symref(worktrees, "NOTES_MERGE_REF",
+                                       default_notes_ref());
                if (wt)
                        die(_("a notes merge into %s is already in-progress at %s"),
                            default_notes_ref(), wt->path);
+               free_worktrees(worktrees);
                if (create_symref("NOTES_MERGE_REF", default_notes_ref(), NULL))
                        die(_("failed to store link to current notes ref (%s)"),
                            default_notes_ref());