Re: [PATCH v7 3/4] alias: support non-alphanumeric names via subsection syntax
- From
- Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
- Date
- Feb 24, 2026, 10:55 UTC
- Message-ID
- <f1f37010-2e93-4e11-8298-420cd8931d62@app.fastmail.com>
- In-Reply-To
- <20260218215737.1181147-4-jonatan@jontes.page>
On Wed, Feb 18, 2026, at 22:57, Jonatan Holmgren wrote:
Show 41 quoted lines
> Git alias names are limited to ASCII alphanumeric characters and > dashes because aliases are implemented as config variable names. > This prevents aliases being created in languages using characters > outside that range. > > 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-ASCII alias names display correctly. > > Suggested-by: Jeff King <peff@peff.net> > Signed-off-by: Jonatan Holmgren <jonatan@jontes.page> > --- > Documentation/config/alias.adoc | 50 ++++++++++++++++++++++----- > alias.c | 38 ++++++++++++++++---- > help.c | 14 ++++++-- > t/t0014-alias.sh | 61 +++++++++++++++++++++++++++++++++ > 4 files changed, 145 insertions(+), 18 deletions(-) > > diff --git a/Documentation/config/alias.adoc b/Documentation/config/alias.adoc > index 80ce17d2de..09a6499249 100644 > --- a/Documentation/config/alias.adoc > +++ b/Documentation/config/alias.adoc >[snip] > +# With subsection (allows any characters, including UTF-8) > +[alias "hämta"] > + command = fetch > +[alias "rätta till"] > + command = commit --amend
This is in `next` now so this is a question or note for later.
Is this `rätta till` supposed to have a space in it? Or is there supposed to be a hyphen? I couldn’t get it to work.
Is the intent to use quotes for the command (in e.g. Bash)?
./bin-wrappers/git "rätta till"
Show 9 quoted lines
> +---- > ++ > +With a Git alias defined, e.g., > + > + $ git config --global alias.last "cat-file commit HEAD" > + # Which is equivalent to > + $ git config --global alias.last.command "cat-file commit HEAD" > + > +`git last` is equivalent to `git cat-file commit HEAD`. To avoid
This is also a note for later. I think this “To avoid” should now be moved to a separate paragraph since it’s a different topic.
Sorry that all my feedback is this late! These are just notes for the list in any case.
Show 6 quoted lines
> +confusion and troubles with script usage, aliases that > +hide existing Git commands are ignored except for deprecated > +commands. Arguments are split by > +spaces, the usual shell quoting and escaping are supported. > +A quote pair or a backslash can be used to quote them. >[snip]