From a5eaff2faaedd00005e0e99d62bfc90653559e25 Mon Sep 17 00:00:00 2001 From: sandroid Date: Wed, 10 Apr 2024 22:45:17 +0200 Subject: [PATCH] Fix gclean preview for directories --- bin/git-forgit | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bin/git-forgit b/bin/git-forgit index d084ccb9..48b02b32 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -471,9 +471,17 @@ _forgit_stash_push() { } _forgit_clean_preview() { - local file - file=$1 - git diff --color=always /dev/null "$file" | _forgit_pager diff + local path + path=$1 + if [[ -d "$path" ]]; then + if hash tree &> /dev/null; then + tree "$path" + else + find "$path" + fi + else + git diff --color=always /dev/null "$path" | _forgit_pager diff + fi } # git clean selector