Skip to content

update-ref: add support for update-symref option

Karthik Nayak git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 22 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8files-backend: extract out `create_symref_lock`refs/files-backend.c+27 -132 replies
2/8reftable-backend: extract out `write_symref_with_log`refs/reftable-backend.c+25 -161 reply
3/8reftable-backend: move `write_symref_with_log` uprefs/reftable-backend.c+58 -580 replies
4/8refs: accept symref in `ref_transaction_add_update`branch.c builtin/fast-import.c builtin/fetch.c +11 more+46 -350 replies
5/8refs/files-backend: add support for symref updatesrefs/files-backend.c+42 -31 reply
6/8refs/reftable-backend: add support for symref updatesrefs/reftable-backend.c+19 -41 reply
7/8refs: add 'update-symref' command to 'update-ref'Documentation/git-update-ref.txt builtin/update-ref.c refs.c +2 more+229 -1016 replies
8/8refs: support symrefs in 'reference-transaction' hookDocumentation/githooks.txt refs.c t/t1416-ref-transaction-hooks.sh+47 -101 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/8] update-ref: add support for update-symref option

From: Karthik Nayak <[email protected]>

The 'git-update-ref(1)' command allows transactional reference updates. But currently only supports regular reference updates. Meaning, if one wants to update HEAD (symbolic ref) in a transaction, there is no tool to do so.

One option to obtain transactional updates for the HEAD ref is to manually create the HEAD.lock file and commit. This is intrusive, where the user needs to mimic internal git behavior. Also, this only works when using the files backend.

At GitLab, we've been using the manual process till date, to allow users to set and change their default branch. But with the introduction of reftables as a reference backend, this becomes a necessity to be solved within git.

This patch series goes about introducing 'update-symref' command for 'git-update-ref(1)'. This command allows the user to create symref in a transaction similar to the 'update' command of 'git-update-ref(1)'. This command also works well with the existing 'no-deref' option.

We don't create a dedicated 'create-symref' since 'update-symref' can also create symrefs. We don't create 'delete-symref', since the 'delete' command can also delete symrefs.

Karthik Nayak (8):
files-backend: extract out create_symref_lock
reftable-backend: extract out write_symref_with_log
reftable-backend: move write_symref_with_log up
refs: accept symref in ref_transaction_add_update refs/files-backend: add support for symref updates refs/reftable-backend: add support for symref updates
refs: add 'update-symref' command to 'update-ref'
refs: support symrefs in 'reference-transaction' hook

 Documentation/git-update-ref.txt |  11 ++-
 Documentation/githooks.txt       |  13 ++-
 branch.c                         |   2 +-
 builtin/fast-import.c            |   6 +-
 builtin/fetch.c                  |   2 +-
 builtin/receive-pack.c           |   2 +-
 builtin/replace.c                |   2 +-
 builtin/tag.c                    |   2 +-
 builtin/update-ref.c             |  63 +++++++++++---
 refs.c                           |  37 ++++++---
 refs.h                           |   9 +-
 refs/files-backend.c             |  95 ++++++++++++++++-----
 refs/refs-internal.h             |  12 ++-
 refs/reftable-backend.c          | 136 ++++++++++++++++++-------------
 sequencer.c                      |   6 +-
 t/t0600-reffiles-backend.sh      |  30 +++++++
 t/t1400-update-ref.sh            | 127 +++++++++++++++++++++++++++++
 t/t1416-ref-transaction-hooks.sh |  27 ++++++
 walker.c                         |   2 +-
 19 files changed, 464 insertions(+), 120 deletions(-)
Signature · 1 line
2.43.GIT