refs: rename refs_create_symref() to refs_update_symref()

The `refs_create_symref()` function is used to update/create a symref.
But it doesn't check the old target of the symref, if existing. It force
updates the symref. In this regard, the name `refs_create_symref()` is a
bit misleading. So let's rename it to `refs_update_symref()`. This is
akin to how 'git-update-ref(1)' also allows us to create apart from
update.

While we're here, rename the arguments in the function to clarify what
they actually signify and reduce confusion.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Karthik Nayak
2024-05-07 14:58:58 +02:00
committed by Junio C Hamano
parent 300b38e46f
commit f151dfe3c9
5 changed files with 9 additions and 11 deletions

View File

@ -118,7 +118,7 @@ static int cmd_create_symref(struct ref_store *refs, const char **argv)
const char *target = notnull(*argv++, "target");
const char *logmsg = *argv++;
return refs_create_symref(refs, refname, target, logmsg);
return refs_update_symref(refs, refname, target, logmsg);
}
static struct flag_definition transaction_flags[] = {