Re: [PATCH] fixup! object-name: make ambiguous object output translatable
From: Junio C Hamano <hidden>
Date: 2021-12-23 22:48:22
Josh Steadmon [off-list ref] 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.
quoted hunk
Signed-off-by: Josh Steadmon <redacted> --- 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