Merge pull request #31 from Gerrit-K/relative-paths

fix: 🐛 Fix relative path issue in add and reset head. #30
This commit is contained in:
Wenxuan 2019-08-26 10:02:32 +08:00 committed by GitHub
commit 5f2e7a0632
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,7 +61,7 @@ forgit::add() {
--preview=\"git diff --color=always -- {-1} $forgit_fancy\"
$FORGIT_ADD_FZF_OPTS
"
files=$(git -c color.status=always status --short |
files=$(git -c color.status=always -c status.relativePaths=true status --short |
grep -F -e "$changed" -e "$unmerged" -e "$untracked" |
awk '{printf "[%10s] ", $1; $1=""; print $0}' |
FZF_DEFAULT_OPTS="$opts" fzf | cut -d] -f2 |
@ -80,7 +80,7 @@ forgit::reset::head() {
-m -0 --preview=\"$cmd\"
$FORGIT_RESET_HEAD_FZF_OPTS
"
files="$(git diff --cached --name-only | FZF_DEFAULT_OPTS="$opts" fzf)"
files="$(git diff --cached --name-only --relative | FZF_DEFAULT_OPTS="$opts" fzf)"
[[ -n "$files" ]] && echo "$files" |xargs -I{} git reset HEAD {} && git status --short && return
echo 'Nothing to unstage.'
}