From fe350db899bdb63416cdc4e5987c551faec19fc6 Mon Sep 17 00:00:00 2001 From: sandr01d <88739791+sandr01d@users.noreply.github.com> Date: Sun, 13 Jul 2025 15:41:14 +0200 Subject: [PATCH] Feat: allow passing arguments to git add (#452) --- bin/git-forgit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/git-forgit b/bin/git-forgit index 4aac1fc..93e2b54 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -462,7 +462,7 @@ _forgit_add() { _forgit_inside_work_tree || return 1 local changed unmerged untracked files opts # Add files if passed as arguments - [[ $# -ne 0 ]] && { _forgit_git_add "$@" && git status -s; return $?; } + _forgit_contains_non_flags "$@" && { _forgit_git_add "$@" && git status -s; return $?; } changed=$(git config --get-color color.status.changed red) unmerged=$(git config --get-color color.status.unmerged red) @@ -482,7 +482,7 @@ _forgit_add() { sed -E 's/^(..[^[:space:]]*)[[:space:]]+(.*)$/[\1] \2/' | FZF_DEFAULT_OPTS="$opts" fzf | _forgit_get_single_file_from_add_line) - [[ "${#files[@]}" -gt 0 ]] && _forgit_git_add "${files[@]}" && git status -s && return + [[ "${#files[@]}" -gt 0 ]] && _forgit_git_add "$@" "${files[@]}" && git status -s && return echo 'Nothing to add.' }