Subject: Re: [PATCH v2 2/2] alias: support non-alphanumeric names via subsection syntax

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 24 Feb 2026 11:27:31 +0100

On Tue, Feb 10, 2026 at 07:31:10PM +0100, Jonatan Holmgren wrote:
> Git alias names are limited to alphanumeric characters and dashes
> because config variable names are validated by iskeychar(). This
> prevents non-English speakers from creating aliases in their native
> languages.
> 
> Add support for arbitrary alias names by using config subsections:
> 
>     [alias "förgrena"]
>         command = branch
> 
> The subsection name is matched as-is (case-sensitive byte comparison),
> while the existing definition without a subsection (e.g.,
> "[alias] co = checkout") remains case-insensitive for backward
> compatibility. This uses existing config infrastructure since
> subsections already support arbitrary bytes, and avoids introducing
> Unicode normalization.
> 
> Also teach the help subsystem about the new syntax so that "git help
> -a" properly lists subsection aliases and the autocorrect feature can
> suggest them. Use utf8_strwidth() instead of strlen() for column
> alignment so that non-alphanumeric alias names display correctly.

This patch has caused a regression in a somewhat esoteric use case.
Before this patch, you could do the following:

    $ git config set "alias..foobar" "!echo barfoo"
    $ git .foobar
    barfoo

Or, phrased as a test case:

    diff --git a/t/t0014-alias.sh b/t/t0014-alias.sh
    index a13d2be8ca..dca50e87e2 100755
    --- a/t/t0014-alias.sh
    +++ b/t/t0014-alias.sh
    @@ -4,6 +4,13 @@ test_description='git command aliasing'

     . ./test-lib.sh

    +test_expect_success 'alias with leading dot' '
    +	test_config_global alias..something "!echo foobar" &&
    +	git .something >actual &&
    +	echo foobar >expect &&
    +	test_cmp expect actual
    +'
    +
     test_expect_success 'nested aliases - internal execution' '
     	git config alias.nested-internal-1 nested-internal-2 &&
     	git config alias.nested-internal-2 status &&

I kind of doubt that this was intentional design, but I know that it is
used e.g. by Dscho in his shears scripts [1]. What this script does is
to create a temporary alias "alias..r" that then gets executed via the
sequencer, and this patch broke this. I happened to discover the
regression as I use shears myself.

Chances are that there are other users out there that rely on the
current behaviour.

Thanks!

Patrick

[1]: https://github.com/git-for-windows/build-extra/blob/a82c8fcb0b8f165c1379c12b0cf914741b8dc8d5/shears.sh