From 25bb8aee24b32b9100e2298be7ca40f0bff465ca Mon Sep 17 00:00:00 2001 From: Max Eisner <4730112+max-ae@users.noreply.github.com> Date: Wed, 20 Apr 2022 19:35:53 +0200 Subject: [PATCH] fix: `forgit::diff` not working if repo path contains spaces --- conf.d/forgit.plugin.fish | 2 +- forgit.plugin.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf.d/forgit.plugin.fish b/conf.d/forgit.plugin.fish index 483b1f0..6424525 100644 --- a/conf.d/forgit.plugin.fish +++ b/conf.d/forgit.plugin.fish @@ -84,7 +84,7 @@ function forgit::diff -d "git diff viewer" --argument-names arg1 arg2 end set repo (git rev-parse --show-toplevel) - set preview "cd $repo && echo {} | sed 's/.*] *//' | sed 's/ -> / /' | xargs git diff --color=always $commits -- | $forgit_diff_pager" + set preview "cd '$repo' && echo {} | sed 's/.*] *//' | sed 's/ -> / /' | xargs git diff --color=always $commits -- | $forgit_diff_pager" set opts " $FORGIT_FZF_DEFAULT_OPTS diff --git a/forgit.plugin.zsh b/forgit.plugin.zsh index 8c89959..f95f12b 100755 --- a/forgit.plugin.zsh +++ b/forgit.plugin.zsh @@ -51,7 +51,7 @@ forgit::diff() { fi } repo="$(git rev-parse --show-toplevel)" - cmd="cd $repo && echo {} |sed 's/.*] *//' | sed 's/ -> / /' |xargs git diff --color=always $commits -- | $forgit_diff_pager" + cmd="cd '$repo' && echo {} |sed 's/.*] *//' | sed 's/ -> / /' |xargs git diff --color=always $commits -- | $forgit_diff_pager" opts=" $FORGIT_FZF_DEFAULT_OPTS +m -0 --bind=\"enter:execute($cmd |LESS='-r' less)\"