From 2903fef2af644527ff2e19b9e6fd9b54bb0af17a Mon Sep 17 00:00:00 2001 From: sandr01d <88739791+sandr01d@users.noreply.github.com> Date: Tue, 23 Apr 2024 23:08:35 +0200 Subject: [PATCH] Fix: Early out from _forgit_stash_push when no files can be stashed (#376) Previously when using _forgit_stash_push without any local changes an empty file picker would open. Exit early and show a message instead. --- bin/git-forgit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/git-forgit b/bin/git-forgit index 00329c5..c10b7b3 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -467,8 +467,8 @@ _forgit_stash_push() { while IFS='' read -r file; do files+=("$file") done < <(git ls-files --exclude-standard --modified --others | - FZF_DEFAULT_OPTS="$opts" fzf) - [[ "${#files[@]}" -eq 0 ]] && return 1 + FZF_DEFAULT_OPTS="$opts" fzf --exit-0) + [[ "${#files[@]}" -eq 0 ]] && echo "Nothing to stash" && return 1 _forgit_git_stash_push ${msg:+-m "$msg"} -u "${files[@]}" }