From b0826102bf991adf1c42b59fdbe841b5103c53b9 Mon Sep 17 00:00:00 2001 From: sandroid Date: Tue, 30 Apr 2024 21:26:47 +0200 Subject: [PATCH] Fix: _forgit_add is missing status indicators and files can not be added when the sed pattern matches (due to missing indicator) --- bin/git-forgit | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/git-forgit b/bin/git-forgit index 3ecfb28..1e00576 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -344,10 +344,13 @@ _forgit_edit_add_file() { # git add selector _forgit_add() { _forgit_inside_work_tree || return 1 - local files opts + local changed unmerged untracked files opts # Add files if passed as arguments [[ $# -ne 0 ]] && { _forgit_git_add "$@" && git status -su; return $?; } + changed=$(git config --get-color color.status.changed red) + unmerged=$(git config --get-color color.status.unmerged red) + untracked=$(git config --get-color color.status.untracked red) opts=" $FORGIT_FZF_DEFAULT_OPTS -0 -m --nth 2..,.. @@ -358,7 +361,8 @@ _forgit_add() { files=() while IFS='' read -r file; do files+=("$file") - done < <(_forgit_list_files --exclude-standard --modified --others | + done < <(git -c color.status=always -c status.relativePaths=true -c core.quotePath=false status -su | + grep -F -e "$changed" -e "$unmerged" -e "$untracked" | sed -E 's/^(..[^[:space:]]*)[[:space:]]+(.*)$/[\1] \2/' | FZF_DEFAULT_OPTS="$opts" fzf | _forgit_get_single_file_from_add_line)