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.
This commit is contained in:
sandr01d 2024-04-23 23:08:35 +02:00 committed by GitHub
parent bc408f155c
commit 2903fef2af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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[@]}"
}