From 267187e0de9dd2e7b6cc6e1f529e82b6be018f67 Mon Sep 17 00:00:00 2001 From: Ilan Cosman Date: Mon, 8 Nov 2021 16:14:48 -0800 Subject: [PATCH] Minor performance improvement for git item --- functions/_tide_item_git.fish | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/functions/_tide_item_git.fish b/functions/_tide_item_git.fish index 6aac29f..9a12cd1 100644 --- a/functions/_tide_item_git.fish +++ b/functions/_tide_item_git.fish @@ -1,14 +1,15 @@ function _tide_item_git if git branch --show-current 2>/dev/null | string replace -r "(.{$tide_git_truncation_length}).+" '$1…' | read -l location - set location $_tide_location_color$location git rev-parse --git-dir --is-inside-git-dir | read -f --line git_dir inside_git_dir + set location $_tide_location_color$location else if test $pipestatus[1] != 0 return - else - # --quiet = don't error if there are no commits + else if git tag --points-at HEAD | string replace -r "(.{$tide_git_truncation_length}).+" '$1…' | read location + git rev-parse --git-dir --is-inside-git-dir | read -f --line git_dir inside_git_dir + set location '#'$_tide_location_color$location + else # --quiet = don't error if there are no commits git rev-parse --git-dir --is-inside-git-dir --quiet --short HEAD | read -f --line git_dir inside_git_dir sha - git tag --points-at HEAD | string replace -r "(.{$tide_git_truncation_length}).+" '$1…' | read location && - set location '#'$_tide_location_color$location || set location @$_tide_location_color$sha + set location @$_tide_location_color$sha end # Operation