git-for-windows/git-sdk-64

etc/DIR_COLORS should include mintty in the TERM list

Opened this issue · 3 comments

In the etc/DIR_COLORS file shipped with Git-for-Windows, many terminal emulators are listed there indicating they support colors. But mintty, the default terminal emulator shipped with Git-for-Windows, is not there.

Because of this, "ls --color" doesn't show any color if the default "mintty" is used as the $TERM. It should be included in it.

dscho commented

@szliu-a good analysis! To continue this analysis, let's find out which package includes this file:

$ pacman -Qo /etc/DIR_COLORS
/etc/DIR_COLORS is owned by coreutils 8.32-4

Ah. That coreutils package is maintained over here. The DIR_COLORS file is mentioned only here, which means that it is left unchanged from the original coreutils sources.

A viable approach might be to insert something like this before the autoreconf call:

grep -q '^TERM mintty' ${srcdir}/${pkgname}-${pkgver}/src/dircolors.hin || {
    (echo "TERM mintty"; sed -n '/^TERM /{:1;N;/\n$/{p;q};b1}' ${srcdir}/${pkgname}-${pkgver}/src/dircolors.hin) |
    sort >/tmp/terms.txt &&
    printf '\n' >>/tmp/terms.txt &&
    sed -i '/^TERM /{
        :1
        N
        /\n$/{
            s/.*//
            r /tmp/terms.txt
            b
        }
        b1
    }' ${srcdir}/${pkgname}-${pkgver}/src/dircolors.hin
}

Or just write a patch like the other modifications are done.

Then, open a PR over at msys2/MSYS2-packages.

Thanks for pointing to the correct package.
I would prefer just using a regular patch, since the list in coreutils package doesn't change often. Do I need to provide that patch or you will write it?

dscho commented

Thanks for pointing to the correct package.
I would prefer just using a regular patch, since the list in coreutils package doesn't change often. Do I need to provide that patch or you will write it?

I won't have the time to write it, sorry!