Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: gsp does not work outside the root directory #386

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bin/git-forgit
Original file line number Diff line number Diff line change
Expand Up @@ -455,18 +455,19 @@ _forgit_stash_push() {
*) _forgit_git_stash_push "${args[@]}"; return $?
esac
done
local opts files
local opts files rootdir
opts="
$FORGIT_FZF_DEFAULT_OPTS
-m
--preview=\"$FORGIT stash_push_preview {}\"
$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 --exit-0)
[[ "${#files[@]}" -eq 0 ]] && echo "Nothing to stash" && return 1
_forgit_git_stash_push ${msg:+-m "$msg"} -u "${files[@]}"
Expand Down