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:
Junio C Hamano
2024-05-20 11:20:04 -07:00
28 changed files with 386 additions and 311 deletions

View File

@ -653,7 +653,7 @@ static void update_remote_refs(const struct ref *refs,
struct strbuf head_ref = STRBUF_INIT;
strbuf_addstr(&head_ref, branch_top);
strbuf_addstr(&head_ref, "HEAD");
if (refs_create_symref(get_main_ref_store(the_repository), head_ref.buf,
if (refs_update_symref(get_main_ref_store(the_repository), head_ref.buf,
remote_head_points_at->peer_ref->name,
msg) < 0)
die(_("unable to update %s"), head_ref.buf);
@ -667,7 +667,7 @@ static void update_head(const struct ref *our, const struct ref *remote,
const char *head;
if (our && skip_prefix(our->name, "refs/heads/", &head)) {
/* Local default branch link */
if (refs_create_symref(get_main_ref_store(the_repository), "HEAD", our->name, NULL) < 0)
if (refs_update_symref(get_main_ref_store(the_repository), "HEAD", our->name, NULL) < 0)
die(_("unable to update HEAD"));
if (!option_bare) {
refs_update_ref(get_main_ref_store(the_repository),
@ -696,7 +696,7 @@ static void update_head(const struct ref *our, const struct ref *remote,
* Unborn head from remote; same as "our" case above except
* that we have no ref to update.
*/
if (refs_create_symref(get_main_ref_store(the_repository), "HEAD", unborn, NULL) < 0)
if (refs_update_symref(get_main_ref_store(the_repository), "HEAD", unborn, NULL) < 0)
die(_("unable to update HEAD"));
if (!option_bare)
install_branch_config(0, head, remote_name, unborn);