Re: [PATCH v4 6/8] refs: introduce the `ref_transaction_update_reflog` function
Karthik Nayak <karthik.188@gmail.com> writes:
Show 35 quoted lines
> Introduce a new function `ref_transaction_update_reflog`, for clients to
> add a reflog update to a transaction. While the existing function
> `ref_transaction_update` also allows clients to add a reflog entry, this
> function does a few things more, It:
> - Enforces that only a reflog entry is added and does not update the
> ref itself.
> - Allows the users to also provide the committer information. This
> means clients can add reflog entries with custom committer
> information.
>
> The `transaction_refname_valid()` function also modifies the error
> message selectively based on the type of the update. This change also
> affects reflog updates which go through `ref_transaction_update()`.
>
> A follow up commit will utilize this function to add reflog support to
> `git refs migrate`.
>
> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
> ---
> refs.c | 39 +++++++++++++++++++++++++++++++++++----
> refs.h | 14 ++++++++++++++
> refs/files-backend.c | 24 ++++++++++++++++--------
> 3 files changed, 65 insertions(+), 12 deletions(-)
>
> diff --git a/refs.c b/refs.c
> index 782bf1090af65196263a3c35ed18d878bb4f2967..8b3882cff17e5e3b0376f75654e32f81a23e5cb2 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1207,14 +1207,14 @@ static int transaction_refname_valid(const char *refname,
> return 1;
>
> if (is_pseudo_ref(refname)) {
> - strbuf_addf(err, _("refusing to update pseudoref '%s'"),
> - refname);
> + const char *what = flags & REF_LOG_ONLY ? "reflog for pseudoref" : "pseudoref";These strings are not localized.
Show 8 quoted lines
> + strbuf_addf(err, _("refusing to update %s '%s'"), what, refname);
> return 0;
> } else if ((new_oid && !is_null_oid(new_oid)) ?
> check_refname_format(refname, REFNAME_ALLOW_ONELEVEL) :
> !refname_is_safe(refname)) {
> - strbuf_addf(err, _("refusing to update ref with bad name '%s'"),
> - refname);
> + const char *what = flags & REF_LOG_ONLY ? "reflog with bad name" : "ref with bad name";Also these strings are not localized.
--
Toon