Re: [PATCH v2 0/2] object-name: fix resolution of object names containing curly braces
From: Junio C Hamano <hidden>
Date: 2025-01-06 20:38:33
Elijah Newren [off-list ref] writes:
quoted hunk
On Mon, Jan 6, 2025 at 9:29 AM Junio C Hamano [off-list ref] wrote:quoted
"Elijah Newren via GitGitGadget" [off-list ref] writes:quoted
Maintainer note: these bugs both date back to 2006; neither is a regression in this cycle.While I was preparing today's -rc2 release, I noticed that this change broke some of my release scripts with $ git rev-parse --verify v2.48.0-rc2-161-g6c2274cdbc^0 fatal: Needed a single revision which is the construct that has been there almost forever. Its expected output is $ git rev-parse --verify v2.48.0-rc2-161-g6c2274cdbc^0 6c2274cdbca14b7eb70fb182ffac80bf6950e137 The series seems to need a bit more work.Gah, I made sure to copy the object name into a string buf, so I could operate on just the relevant part, but then ignored that and operated on the full thing. This fixes it:diff --git a/object-name.c b/object-name.c index 614520954c7..cb96a0e6161 100644 --- a/object-name.c +++ b/object-name.c@@ -1318,7 +1318,7 @@ static int ref_and_count_parts_valid(const char*name, int len) len = cp - name; strbuf_init(&sb, len); strbuf_add(&sb, name, len); - ret = !check_refname_format(name, flags); + ret = !check_refname_format(sb.buf, flags); strbuf_release(&sb); return ret; } I'll include it with all my other fixes in a reroll, which I'll probably send out after 2.48 to avoid distracting from the release.
In existing tests, we seem to be lacking coverage to notice this breakage, so let's make sure we add one or two. Thanks.