On Tue, Feb 14, 2023 at 11:29:15AM -0500, Eric Sunshine wrote: > > +static char *match_parse_rule(const char *refname, const char *rule) > > Yes, this works nicely and fixes the reported problem: > > % $GIT_DIR/bin-wrappers/git symbolic-ref --short HEAD > 测试-加-增加-加-增加 > > I'm all for this approach. Fewer scanf()'s, the better. > > The new code itself looks correct; I think it properly covers all the > edge-cases (at least those that came to my mind). There's a leak in it when there is an ambiguous ref (because we allocate short_name in each iteration of the loop, rather than overwriting the buffer). I'll post a fixed version in a moment. -Peff