]> git.ipfire.org Git - thirdparty/git.git/commit
pretty: find pretty formats case-insensitively
authorBrian Lyles <brianmlyles@gmail.com>
Mon, 25 Mar 2024 07:25:13 +0000 (02:25 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Mar 2024 19:19:48 +0000 (12:19 -0700)
commitf999d5188b4060aa0f784a6f4cf1574ea352a1e7
tree4851650730d7f1c7ecf4f7009464331ec00fd0f3
parent2cd134f2c538a9cb7b0946ace6004489eba9535f
pretty: find pretty formats case-insensitively

User-defined pretty formats are stored in config, which is meant to use
case-insensitive matching for names as noted in config.txt's 'Syntax'
section:

    All the other lines [...] are recognized as setting variables, in
    the form 'name = value' [...]. The variable names are
    case-insensitive, [...].

When a user specifies one of their format aliases with an uppercase in
it, however, it is not found.

    $ git config pretty.testAlias %h
    $ git config --list | grep pretty
    pretty.testalias=%h
    $ git log --format=testAlias -1
    fatal: invalid --pretty format: testAlias
    $ git log --format=testalias -1
    3c2a3fdc38

This is true whether the name in the config file uses any uppercase
characters or not.

Use case-insensitive comparisons when identifying format aliases.

Co-authored-by: Jeff King <peff@peff.net>
Signed-off-by: Brian Lyles <brianmlyles@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pretty.c
t/t4205-log-pretty-formats.sh