[PATCH] fixup! object-name: make ambiguous object output translatable
- From
Josh Steadmon <steadmon@google.com>
- Date
- Dec 23, 2021, 21:54 UTC
- Message-ID
- <ec6a20a3d694d1d7e3db14f6bab42aff3e82c135.1640295389.git.steadmon@google.com>
- In-Reply-To
- <patch-v5-3.6-b79964483e8-20211125T215529Z-avarab@gmail.com>
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.
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
-- 2.34.1.448.ga2b2bfdf31-goog