From 4c489c0d6805f4bf0f64841b2fff101506984dcf Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Tue, 17 Jan 2023 01:44:01 +0100 Subject: [PATCH] git:last-changed: Handle non-git-repo gracefully --- .config/zsh/autoload/git/git-last-changed | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.config/zsh/autoload/git/git-last-changed b/.config/zsh/autoload/git/git-last-changed index f6b7660..9e09434 100755 --- a/.config/zsh/autoload/git/git-last-changed +++ b/.config/zsh/autoload/git/git-last-changed @@ -5,6 +5,12 @@ # sort the entries by the commits date and time to see the most recent changed # files/folders at the bottom. +# Execute normal ls when not in git repo +if ! git rev-parse 2>/dev/null; then + ls -1p --color=auto "$@" + return +fi + local color_set [ -t 1 ] && color_set=always || color_set=never