Skip to content

Commit

Permalink
Fix: Early out from _forgit_stash_push when no files can be stashed (#…
Browse files Browse the repository at this point in the history
…376)

Previously when using _forgit_stash_push without any local changes an empty file picker would open. Exit early and show a message instead.
  • Loading branch information
sandr01d authored Apr 23, 2024
1 parent bc408f1 commit 2903fef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/git-forgit
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"
}

Expand Down

0 comments on commit 2903fef

Please sign in to comment.