fish_git_prompt: include T (typechange) in status filter

The status entry filter regex was missing T, which is a valid
porcelain status code for file type changes (e.g. regular file
to symlink). Without it, typechange entries would be silently
dropped from dirty/staged detection.

Closes #12754
This commit is contained in:
June Kim
2026-05-12 21:18:42 -07:00
committed by Johannes Altmanninger
parent f86c9af455
commit a93fcd97a7

View File

@@ -301,7 +301,7 @@ function fish_git_prompt --description "Prompt function for Git"
# Renames and copies in porcelain -z output have an extra NUL-delimited
# field for the source path. Filter to entries starting with a valid
# two-char status code followed by a space to skip those bare paths.
set -l stat (command git -c core.fsmonitor= status --porcelain -z $opt | string split0 | string match -r '^[ MADRCU?!]{2} .*')
set -l stat (command git -c core.fsmonitor= status --porcelain -z $opt | string split0 | string match -r '^[ MADRCTU?!]{2} .*')
set dirtystate (string match -qr '^.[ACDMRTU]' -- $stat; and echo 1)
if test -n "$sha"
@@ -427,7 +427,7 @@ function __fish_git_prompt_informative_status
# Renames and copies in porcelain -z output have an extra NUL-delimited
# field for the source path. Filter to entries starting with a valid
# two-char status code followed by a space to skip those bare paths.
set -l stats (string sub -l 2 (git -c core.fsmonitor= status --porcelain -z $untr | string split0 | string match -r '^[ MADRCU?!]{2} .*'))
set -l stats (string sub -l 2 (git -c core.fsmonitor= status --porcelain -z $untr | string split0 | string match -r '^[ MADRCTU?!]{2} .*'))
set -l invalidstate (string match -r '^UU' $stats | count)
set -l stagedstate (string match -r '^[ACDMRT].' $stats | count)
set -l dirtystate (string match -r '^.[ACDMRT]' $stats | count)