diff options
author | Karthik Nayak <karthik.188@gmail.com> | 2024-06-07 15:33:01 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-06-07 19:25:44 +0200 |
commit | 2343720967aac3725148e1a6690dbe6c98fe5f2e (patch) | |
tree | 38b682117482317d7e3ffcc743734a6f6b9225e3 /refs.h | |
parent | update-ref: add support for 'symref-verify' command (diff) | |
download | git-2343720967aac3725148e1a6690dbe6c98fe5f2e.tar.xz git-2343720967aac3725148e1a6690dbe6c98fe5f2e.zip |
update-ref: add support for 'symref-delete' command
Add a new command 'symref-delete' to allow deletions of symbolic refs in
a transaction via the '--stdin' mode of the 'git-update-ref' command.
The 'symref-delete' command can, when given an <old-target>, delete the
provided <ref> only when it points to <old-target>.
This command is only compatible with the 'no-deref' mode because we
optionally want to check the 'old_target' of the ref being deleted.
De-referencing a symbolic ref would provide a regular ref and we already
have the 'delete' command for regular refs.
While users can also use 'git symbolic-ref -d' to delete symbolic refs,
the 'symref-delete' command in 'git-update-ref' allows users to do so
within a transaction, which promises atomicity of the operation and can
be batched with other commands.
When no 'old_target' is provided it can also delete regular refs,
similar to how the 'delete' command can delete symrefs when no 'old_oid'
is provided.
Helped-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.h')
-rw-r--r-- | refs.h | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -767,7 +767,9 @@ int ref_transaction_create(struct ref_transaction *transaction, int ref_transaction_delete(struct ref_transaction *transaction, const char *refname, const struct object_id *old_oid, - unsigned int flags, const char *msg, + const char *old_target, + unsigned int flags, + const char *msg, struct strbuf *err); /* |