From 3bfb1553d13040c2073cb16bbbe300e2aedb56f4 Mon Sep 17 00:00:00 2001 From: tavo-wasd Date: Fri, 14 Jun 2024 20:27:45 -0600 Subject: [PATCH] fix --- shell/bashrc | 6 +++--- shell/mkshrc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/shell/bashrc b/shell/bashrc index df6f980..e72c944 100644 --- a/shell/bashrc +++ b/shell/bashrc @@ -54,12 +54,12 @@ short_time() { short_path() { curr_path="$(pwd | sed 's/\/home\/[A-Za-z]*/~/g')" - if [ "${#curr_path}" -gt 30 ] ; then + if [ "${#curr_path}" -gt 25 ] ; then curr_path="${curr_path##*/}" if git rev-parse --is-inside-work-tree >/dev/null 2>&1 ; then - curr_proj="$(git rev-parse --show-toplevel)" + curr_proj="$(git rev-parse --show-toplevel 2>/dev/null)" curr_proj="${curr_proj##*/}" - if [ "$curr_path" != "$curr_proj" ] ; then + if [ "$curr_proj" ] && [ "$curr_path" != "$curr_proj" ] ; then [ -d "../../$curr_proj/$curr_path" ] && curr_path="$curr_proj/$curr_path" || curr_path="$curr_proj/⋯/$curr_path" diff --git a/shell/mkshrc b/shell/mkshrc index 3e40125..e050e2e 100644 --- a/shell/mkshrc +++ b/shell/mkshrc @@ -39,12 +39,12 @@ short_time() { short_path() { curr_path="$(pwd | sed 's/\/home\/[A-Za-z]*/~/g')" - if [ "${#curr_path}" -gt 30 ] ; then + if [ "${#curr_path}" -gt 25 ] ; then curr_path="${curr_path##*/}" if git rev-parse --is-inside-work-tree >/dev/null 2>&1 ; then - curr_proj="$(git rev-parse --show-toplevel)" + curr_proj="$(git rev-parse --show-toplevel 2>/dev/null)" curr_proj="${curr_proj##*/}" - if [ "$curr_path" != "$curr_proj" ] ; then + if [ "$curr_proj" ] && [ "$curr_path" != "$curr_proj" ] ; then [ -d "../../$curr_proj/$curr_path" ] && curr_path="$curr_proj/$curr_path" || curr_path="$curr_proj/⋯/$curr_path"