Merge branch 'kn/ref-transaction-symref'
Updates to symbolic refs can now be made as a part of ref transaction. * kn/ref-transaction-symref: refs: remove `create_symref` and associated dead code refs: rename `refs_create_symref()` to `refs_update_symref()` refs: use transaction in `refs_create_symref()` refs: add support for transactional symref updates refs: move `original_update_refname` to 'refs.c' refs: support symrefs in 'reference-transaction' hook files-backend: extract out `create_symref_lock()` refs: accept symref values in `ref_transaction_update()`
This commit is contained in:
11
sequencer.c
11
sequencer.c
@ -666,7 +666,7 @@ static int fast_forward_to(struct repository *r,
|
||||
if (!transaction ||
|
||||
ref_transaction_update(transaction, "HEAD",
|
||||
to, unborn && !is_rebase_i(opts) ?
|
||||
null_oid() : from,
|
||||
null_oid() : from, NULL, NULL,
|
||||
0, sb.buf, &err) ||
|
||||
ref_transaction_commit(transaction, &err)) {
|
||||
ref_transaction_free(transaction);
|
||||
@ -1301,7 +1301,7 @@ int update_head_with_reflog(const struct commit *old_head,
|
||||
if (!transaction ||
|
||||
ref_transaction_update(transaction, "HEAD", new_head,
|
||||
old_head ? &old_head->object.oid : null_oid(),
|
||||
0, sb.buf, err) ||
|
||||
NULL, NULL, 0, sb.buf, err) ||
|
||||
ref_transaction_commit(transaction, err)) {
|
||||
ret = -1;
|
||||
}
|
||||
@ -3835,8 +3835,9 @@ static int do_label(struct repository *r, const char *name, int len)
|
||||
} else if (repo_get_oid(r, "HEAD", &head_oid)) {
|
||||
error(_("could not read HEAD"));
|
||||
ret = -1;
|
||||
} else if (ref_transaction_update(transaction, ref_name.buf, &head_oid,
|
||||
NULL, 0, msg.buf, &err) < 0 ||
|
||||
} else if (ref_transaction_update(transaction, ref_name.buf,
|
||||
&head_oid, NULL, NULL, NULL,
|
||||
0, msg.buf, &err) < 0 ||
|
||||
ref_transaction_commit(transaction, &err)) {
|
||||
error("%s", err.buf);
|
||||
ret = -1;
|
||||
@ -5043,7 +5044,7 @@ cleanup_head_ref:
|
||||
}
|
||||
msg = reflog_message(opts, "finish", "returning to %s",
|
||||
head_ref.buf);
|
||||
if (refs_create_symref(get_main_ref_store(the_repository), "HEAD", head_ref.buf, msg)) {
|
||||
if (refs_update_symref(get_main_ref_store(the_repository), "HEAD", head_ref.buf, msg)) {
|
||||
res = error(_("could not update HEAD to %s"),
|
||||
head_ref.buf);
|
||||
goto cleanup_head_ref;
|
||||
|
Reference in New Issue
Block a user