Re: [PATCH] fixup! object-name: make ambiguous object output translatable
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 23, 2021, 22:48 UTC
- Message-ID
- <xmqqmtkr6iq8.fsf@gitster.g>
- In-Reply-To
- <ec6a20a3d694d1d7e3db14f6bab42aff3e82c135.1640295389.git.steadmon@google.com>
Josh Steadmon <steadmon@google.com> writes:
> A nitpick, but the "ad" and "s" strbuf names here are not very friendly > for readers who don't know offhand what the format_commit_message fields > expand to. This makes them more self-descriptive.
Sounds like a sensible change. It seems that this thread didn't have gathered much interest by others (not many review comments), or by its author (not an ack to a suggestion like this), so perhaps I should put on a cold storage and expect an update when the list is a bit more quiescent.
Thanks.
Show 46 quoted lines
> Signed-off-by: Josh Steadmon <steadmon@google.com>
> ---
> object-name.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/object-name.c b/object-name.c
> index 1dcbba7fa7..dcf3ab9999 100644
> --- a/object-name.c
> +++ b/object-name.c
> @@ -378,15 +378,15 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
> type == OBJ_BLOB || type == OBJ_TAG);
>
> if (type == OBJ_COMMIT) {
> - struct strbuf ad = STRBUF_INIT;
> - struct strbuf s = STRBUF_INIT;
> + struct strbuf date = STRBUF_INIT;
> + struct strbuf msg = STRBUF_INIT;
> struct commit *commit = lookup_commit(ds->repo, oid);
>
> if (commit) {
> struct pretty_print_context pp = {0};
> pp.date_mode.type = DATE_SHORT;
> - format_commit_message(commit, "%ad", &ad, &pp);
> - format_commit_message(commit, "%s", &s, &pp);
> + format_commit_message(commit, "%ad", &date, &pp);
> + format_commit_message(commit, "%s", &msg, &pp);
> }
>
> /*
> @@ -395,10 +395,11 @@ static int show_ambiguous_object(const struct object_id *oid, void *data)
> *
> * "deadbeef commit 2021-01-01 - Some Commit Message"
> */
> - strbuf_addf(&desc, _("%s commit %s - %s"), hash, ad.buf, s.buf);
> + strbuf_addf(&desc, _("%s commit %s - %s"),
> + hash, date.buf, msg.buf);
>
> - strbuf_release(&ad);
> - strbuf_release(&s);
> + strbuf_release(&date);
> + strbuf_release(&msg);
> } else if (type == OBJ_TAG) {
> struct tag *tag = lookup_tag(ds->repo, oid);
> const char *tag_tag = "";
>
> base-commit: ea5019ecd7a405d7d5f6527054d0aaca2d3b4bcd