From 5876ff66ff3e46c9ca6a3c20556e6553d3245f91 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Thu, 14 May 2026 00:17:12 +0800 Subject: [PATCH] fish_git_prompt: fix buggy rename parsing Commit f86c9af4552 (fish_git_prompt: skip rename/copy source paths in status parsing, 2026-05-12). filters from "git-status --porcelain" output all lines that don't look like a status entry. This is to filter out the rename source path. But the filtering has false positives, e.g. if a rename source path starts with "AA". Let's only skip lines immediately after each rename entry. Also for copy (C) though I haven't found a test case for that yet. --- share/functions/fish_git_prompt.fish | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/share/functions/fish_git_prompt.fish b/share/functions/fish_git_prompt.fish index 79f1b81d5..ec8ff7423 100644 --- a/share/functions/fish_git_prompt.fish +++ b/share/functions/fish_git_prompt.fish @@ -408,9 +408,17 @@ end ### helper functions function __fish_git_prompt_status_porcelain_modulo_rename_source - git -c core.fsmonitor= status --porcelain -z $argv | - string split0 | - string match -r '^[ MADRCTU?!]{2} .*' + set -l skip false + for line in (git -c core.fsmonitor= status --porcelain -z $argv | string split0) + if $skip + set skip false + continue + end + printf %s\n $line + if string match -rq -- ^[RC] $line + set skip true + end + end end function __fish_git_prompt_informative_status