Re: [PATCH v2 1/2] rebase: refactor dwim_ref_or_die from merge-base.c
- From
- Alex Torok <alext9@gmail.com>
- Date
- Dec 6, 2019, 13:13 UTC
- Message-ID
- <CANmPhj1vSQYmwix7FMMBAksSTUJpz0izJyehmOhThkUfyUBy+w@mail.gmail.com>
- In-Reply-To
- <20191206012335.GA16183@generichostname>
On Thu, Dec 5, 2019 at 8:23 PM Denton Liu <liu.denton@gmail.com> wrote:
> The remaining paragraphs shouldn't end up going into the commit message > since they're more like "notes to reviewers". You should place these > notes under the `---` below so that they won't end up in the final > commit message.
Thank you for the info! I'll keep that in mind for my next patch submission.
Show 17 quoted lines
> > +void dwim_ref_or_die(const char *str, int len, char **ref)
> > +{
> > + struct object_id discard;
> > + switch (dwim_ref(str, len, &discard, ref)) {
> > + case 0:
> > + die("No such ref: '%s'", str);
>
> I see that this code is copied so I'm fine with leaving it as is. But if
> you need to do any rerolls, it would be nice to, as a prepatory step,
> introduce a patch which 1. marks these strings for translation and 2.
> lowercases the first letter of the sentence which is the convention for
> messages that are seen by the end-user.
>
> Perhaps:
>
> die(_("no such ref: '%s'"), str);
>Sounds good! I'll add a patch to the end of this series that addresses these strings not being translated.
Thank you for your feedback. ~Alex
Show 33 quoted lines
> > + case 1:
> > + break; /* good */
> > + default:
> > + die("Ambiguous refname: '%s'", str);
>
> Same comment here.
>
> Thanks,
>
> Denton
>
> > + }
> > +}
> > +
> > +
> > int expand_ref(struct repository *repo, const char *str, int len,
> > struct object_id *oid, char **ref)
> > {
> > diff --git a/refs.h b/refs.h
> > index 730d05ad91..a961662382 100644
> > --- a/refs.h
> > +++ b/refs.h
> > @@ -154,6 +154,7 @@ int repo_dwim_log(struct repository *r, const char *str, int len, struct object_
> > int dwim_ref(const char *str, int len, struct object_id *oid, char **ref);
> > int dwim_log(const char *str, int len, struct object_id *oid, char **ref);
> >
> > +void dwim_ref_or_die(const char *str, int len, char **ref);
> > /*
> > * A ref_transaction represents a collection of reference updates that
> > * should succeed or fail together.
> > --
> > 2.17.1
> >