cocci: apply rules to rewrite callers of "refs" interfaces
Apply the rules that rewrite callers of "refs" interfaces to explicitly pass `struct ref_store`. The resulting patch has been applied with the `--whitespace=fix` option. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
b198ee0b3d
commit
2e5c4758b7
@@ -794,9 +794,9 @@ static int merge_abort(struct notes_merge_options *o)
|
||||
* notes_merge_abort() to remove .git/NOTES_MERGE_WORKTREE.
|
||||
*/
|
||||
|
||||
if (delete_ref(NULL, "NOTES_MERGE_PARTIAL", NULL, 0))
|
||||
if (refs_delete_ref(get_main_ref_store(the_repository), NULL, "NOTES_MERGE_PARTIAL", NULL, 0))
|
||||
ret += error(_("failed to delete ref NOTES_MERGE_PARTIAL"));
|
||||
if (delete_ref(NULL, "NOTES_MERGE_REF", NULL, REF_NO_DEREF))
|
||||
if (refs_delete_ref(get_main_ref_store(the_repository), NULL, "NOTES_MERGE_REF", NULL, REF_NO_DEREF))
|
||||
ret += error(_("failed to delete ref NOTES_MERGE_REF"));
|
||||
if (notes_merge_abort(o))
|
||||
ret += error(_("failed to remove 'git notes merge' worktree"));
|
||||
@@ -834,7 +834,8 @@ static int merge_commit(struct notes_merge_options *o)
|
||||
init_notes(t, "NOTES_MERGE_PARTIAL", combine_notes_overwrite, 0);
|
||||
|
||||
o->local_ref = local_ref_to_free =
|
||||
resolve_refdup("NOTES_MERGE_REF", 0, &oid, NULL);
|
||||
refs_resolve_refdup(get_main_ref_store(the_repository),
|
||||
"NOTES_MERGE_REF", 0, &oid, NULL);
|
||||
if (!o->local_ref)
|
||||
die(_("failed to resolve NOTES_MERGE_REF"));
|
||||
|
||||
@@ -847,9 +848,10 @@ static int merge_commit(struct notes_merge_options *o)
|
||||
&pretty_ctx);
|
||||
strbuf_trim(&msg);
|
||||
strbuf_insertstr(&msg, 0, "notes: ");
|
||||
update_ref(msg.buf, o->local_ref, &oid,
|
||||
is_null_oid(&parent_oid) ? NULL : &parent_oid,
|
||||
0, UPDATE_REFS_DIE_ON_ERR);
|
||||
refs_update_ref(get_main_ref_store(the_repository), msg.buf,
|
||||
o->local_ref, &oid,
|
||||
is_null_oid(&parent_oid) ? NULL : &parent_oid,
|
||||
0, UPDATE_REFS_DIE_ON_ERR);
|
||||
|
||||
free_notes(t);
|
||||
strbuf_release(&msg);
|
||||
@@ -961,14 +963,16 @@ static int merge(int argc, const char **argv, const char *prefix)
|
||||
|
||||
if (result >= 0) /* Merge resulted (trivially) in result_oid */
|
||||
/* Update default notes ref with new commit */
|
||||
update_ref(msg.buf, default_notes_ref(), &result_oid, NULL, 0,
|
||||
UPDATE_REFS_DIE_ON_ERR);
|
||||
refs_update_ref(get_main_ref_store(the_repository), 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);
|
||||
refs_update_ref(get_main_ref_store(the_repository), msg.buf,
|
||||
"NOTES_MERGE_PARTIAL", &result_oid, NULL,
|
||||
0, UPDATE_REFS_DIE_ON_ERR);
|
||||
/* Store ref-to-be-updated into .git/NOTES_MERGE_REF */
|
||||
worktrees = get_worktrees();
|
||||
wt = find_shared_symref(worktrees, "NOTES_MERGE_REF",
|
||||
@@ -977,7 +981,7 @@ static int merge(int argc, const char **argv, const char *prefix)
|
||||
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))
|
||||
if (refs_create_symref(get_main_ref_store(the_repository), "NOTES_MERGE_REF", default_notes_ref(), NULL))
|
||||
die(_("failed to store link to current notes ref (%s)"),
|
||||
default_notes_ref());
|
||||
fprintf(stderr, _("Automatic notes merge failed. Fix conflicts in %s "
|
||||
|
||||
Reference in New Issue
Block a user