Skip to content

Commit

Permalink
Fix: gsp does not work outside the root directory
Browse files Browse the repository at this point in the history
  • Loading branch information
sandr01d committed Apr 19, 2024
1 parent d240263 commit 0fb649c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/git-forgit
Original file line number Diff line number Diff line change
Expand Up @@ -454,17 +454,18 @@ _forgit_stash_push() {
*) _forgit_git_stash_push "${args[@]}"; return $?
esac
done
local opts files
local opts files rootdir
opts="
$FORGIT_FZF_DEFAULT_OPTS
-m
$FORGIT_STASH_PUSH_FZF_OPTS
"
rootdir=$(git rev-parse --show-toplevel)
# Show both modified and untracked files
files=()
while IFS='' read -r file; do
files+=("$file")
done < <(git ls-files --exclude-standard --modified --others |
done < <(git ls-files "$rootdir" --exclude-standard --modified --others |
FZF_DEFAULT_OPTS="$opts" fzf --preview="$FORGIT stash_push_preview {}")
[[ "${#files[@]}" -eq 0 ]] && return 1
_forgit_git_stash_push ${msg:+-m "$msg"} -u "${files[@]}"
Expand Down

0 comments on commit 0fb649c

Please sign in to comment.