Re: [PATCH v4 2/7] git: allow alias-shadowing deprecated builtins
- From
Jeff King <peff@peff.net>
- Date
- Sep 10, 2025, 05:13 UTC
- Message-ID
- <20250910051347.GA556174@coredump.intra.peff.net>
- In-Reply-To
- <672253e0e7167c40290d1fef6d5076adfbe25d80.1757446619.git.code@khaugsbakk.name>
On Tue, Sep 09, 2025 at 09:45:52PM +0200, kristofferhaugsbakk@fastmail.com wrote:
Show 7 quoted lines
> + if (is_deprecated_command(args->v[0]) &&
> + alias_lookup(args->v[0])) {
> + if (!handle_alias(args))
> + break;
> + done_alias = 1;
> + continue;
> + }I think this is failing the SANITIZE=leak jobs, because alias_lookup() returns an allocated string with the alias. You need to capture and free it, or introduce an alias_exists() wrapper to do so.
There might also be a way to do it just by calling handle_alias() and checking its return value (it seems to indicate whether an alias was found, but I didn't look through the whole function carefully, or think about the implications of how the done_alias flag works).
-Peff