summaryrefslogtreecommitdiffstats
path: root/refs.h
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2024-06-07 15:33:01 +0200
committerJunio C Hamano <gitster@pobox.com>2024-06-07 19:25:44 +0200
commit2343720967aac3725148e1a6690dbe6c98fe5f2e (patch)
tree38b682117482317d7e3ffcc743734a6f6b9225e3 /refs.h
parentupdate-ref: add support for 'symref-verify' command (diff)
downloadgit-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.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/refs.h b/refs.h
index 48cec1ba72..5b84958528 100644
--- a/refs.h
+++ b/refs.h
@@ -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);
/*