Message ID | 20240426152449.228860-1-knayak@gitlab.com (mailing list archive) |
---|---|
Headers | show |
Series | add symref-* commands to 'git-update-ref --stdin' | expand |
Karthik Nayak <karthik.188@gmail.com> writes: > From: Karthik Nayak <karthik.188@gmail.com> > > 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 a set of commands > symref-{create,verify,delete,update} to work with symrefs complimenting > the existing commands for the regular refs in the '--stdin' mode of > 'git-update-ref'. > > The 'symref-verify' command can be used to verify if a symref exists and > its existing value. > > The 'symref-create' command can be used to create a new symref. > > The 'symref-delete' command can be used to delete an existing symref while > optionally checking its existing value. > > The 'symref-update' command can be used to update a symref, create a symref, > delete a symref or even convert an existing regular ref to a symref. Wherein > like the regular 'update' command, the zero OID can be used to create/delete > a symref. > > While this series adds the commands and the required ground work, it only > is accessile within the '--stdin' mode of 'git-update-ref'. However, it makes > it easy to extend it further to the command line too, which will be present > in a follow up series. > Also, I'll be pushing a new version with reduced scope soon. The idea being that we can review/merge the part which adds the symref support to the refs library first and then we can have a followup for exposing the same to the users via git-update-ref. This should make it also easier for reviewers. [snip]