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>
This commit is contained in:

committed by
Junio C Hamano

parent
1451ac734f
commit
2343720967
@ -1382,8 +1382,8 @@ static int prune_refs(struct display_state *display_state,
|
||||
if (!dry_run) {
|
||||
if (transaction) {
|
||||
for (ref = stale_refs; ref; ref = ref->next) {
|
||||
result = ref_transaction_delete(transaction, ref->name, NULL, 0,
|
||||
"fetch: prune", &err);
|
||||
result = ref_transaction_delete(transaction, ref->name, NULL,
|
||||
NULL, 0, "fetch: prune", &err);
|
||||
if (result)
|
||||
goto cleanup;
|
||||
}
|
||||
|
Reference in New Issue
Block a user