From 4397e5092b6cb83062f4a62834b00d551ab1575b Mon Sep 17 00:00:00 2001 From: Mateus Auler Date: Sat, 20 Apr 2024 23:21:12 -0300 Subject: [PATCH] Fail silently when listing, if the user is not in a git repo --- wt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wt b/wt index 766b613..df8abc0 100755 --- a/wt +++ b/wt @@ -17,7 +17,9 @@ arg=$(echo "${args[0]}" | sed 's/\//\\\//g') # show worktree list worktree_list() { - git worktree list + if git rev-parse --git-dir &> /dev/null; then + git worktree list + fi } help_message() {