Re: bug report: symbolic-ref --short command echos the wrong text while use Chinese language
- From
Jeff King <peff@peff.net>
- Date
- Feb 14, 2023, 17:07 UTC
- Message-ID
- <Y+u/xUQJoWVWULn6@coredump.intra.peff.net>
- In-Reply-To
- <CAPig+cTH1hUTSN+TRCo9brGMosEW-OWV0JVBATK+moB0EZec3w@mail.gmail.com>
On Tue, Feb 14, 2023 at 11:29:15AM -0500, Eric Sunshine wrote:
Show 11 quoted lines
> > +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