aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAstounds <kirito@disroot.org>2025-11-05 11:14:26 -0500
committerAstounds <kirito@disroot.org>2025-11-05 11:14:26 -0500
commit53a8e4044b939d0501a2f448f70f30b1c428f46a (patch)
tree162cfdbe4e68281ce3a7cf19fdf7780d7a2b9ad2
parent9d2ca59258264a655e99d6a77327e6063a285dad (diff)
downloadhyperterm-53a8e4044b939d0501a2f448f70f30b1c428f46a.tar.lz
hyperterm-53a8e4044b939d0501a2f448f70f30b1c428f46a.tar.xz
hyperterm-53a8e4044b939d0501a2f448f70f30b1c428f46a.zip
Add show no-upstream indicator
-rw-r--r--hyperterm/core/git.sh35
-rw-r--r--hyperterm/hyperterm.sha5122
2 files changed, 28 insertions, 9 deletions
diff --git a/hyperterm/core/git.sh b/hyperterm/core/git.sh
index 8b285ab..1e11bde 100644
--- a/hyperterm/core/git.sh
+++ b/hyperterm/core/git.sh
@@ -13,6 +13,7 @@ _init_git_symbols() {
GIT_SYMBOLS[ahead]="↑"
GIT_SYMBOLS[behind]="↓"
GIT_SYMBOLS[diverged]="↕"
+ GIT_SYMBOLS[no_upstream]="○"
GIT_SYMBOLS[untracked]="?"
GIT_SYMBOLS[added]="+"
GIT_SYMBOLS[deleted]="D"
@@ -48,6 +49,7 @@ _parse_git_status() {
# Get ahead/behind counts - use more reliable method
if git rev-parse --abbrev-ref "@{upstream}" >/dev/null 2>&1; then
+ GIT_STATUS[has_upstream]=1
# Use separate commands for more reliable parsing
GIT_STATUS[ahead]="$(git rev-list --count HEAD ^"@{upstream}" 2>/dev/null || echo 0)"
GIT_STATUS[behind]="$(git rev-list --count "@{upstream}" ^HEAD 2>/dev/null || echo 0)"
@@ -61,6 +63,7 @@ _parse_git_status() {
fi
fi
else
+ GIT_STATUS[has_upstream]=0
GIT_STATUS[behind]=0
GIT_STATUS[ahead]=0
fi
@@ -116,24 +119,40 @@ _get_git_status_fast() {
local output=""
- # Check if completely clean (no dirty files AND no ahead/behind)
- if [[ ${GIT_STATUS[dirty]} -eq 0 && ${GIT_STATUS[ahead]} -eq 0 && ${GIT_STATUS[behind]} -eq 0 ]]; then
+ # Check if completely clean (no dirty files AND no ahead/behind AND has upstream)
+ if [[ ${GIT_STATUS[dirty]} -eq 0 && ${GIT_STATUS[ahead]} -eq 0 && ${GIT_STATUS[behind]} -eq 0 && ${GIT_STATUS[has_upstream]} -eq 1 ]]; then
echo -n "${BOLD}${CYAN}${GIT_SYMBOLS[clean]}${RESET}"
return
fi
+ # Check if clean but no upstream (local branch only)
+ if [[ ${GIT_STATUS[dirty]} -eq 0 && ${GIT_STATUS[has_upstream]} -eq 0 ]]; then
+ echo -n "${BOLD}${PURPLE}${GIT_SYMBOLS[no_upstream]}${RESET}"
+ return
+ fi
+
# Start with dirty indicator if there are dirty files
if [[ ${GIT_STATUS[dirty]} -gt 0 ]]; then
output="${BOLD}${YELLOW}${GIT_SYMBOLS[dirty]}${GIT_STATUS[dirty]}${RESET}"
fi
# Add ahead/behind status with semantic colors
- if [[ ${GIT_STATUS[ahead]} -gt 0 && ${GIT_STATUS[behind]} -gt 0 ]]; then
- output+="${BOLD}${ORANGE}${GIT_SYMBOLS[diverged]}${GIT_STATUS[ahead]}/${GIT_STATUS[behind]}${RESET}"
- elif [[ ${GIT_STATUS[ahead]} -gt 0 ]]; then
- output+="${BOLD}${GREEN}${GIT_SYMBOLS[ahead]}${GIT_STATUS[ahead]}${RESET}"
- elif [[ ${GIT_STATUS[behind]} -gt 0 ]]; then
- output+="${BOLD}${RED}${GIT_SYMBOLS[behind]}${GIT_STATUS[behind]}${RESET}"
+ if [[ ${GIT_STATUS[has_upstream]} -eq 1 ]]; then
+ # Create pattern: "ahead_behind" (0=false, 1=true)
+ local ahead_flag
+ local behind_flag
+ ahead_flag=$([[ ${GIT_STATUS[ahead]} -gt 0 ]] && echo "1" || echo "0")
+ behind_flag=$([[ ${GIT_STATUS[behind]} -gt 0 ]] && echo "1" || echo "0")
+
+ case "${ahead_flag}${behind_flag}" in
+ "11") output+="${BOLD}${ORANGE}${GIT_SYMBOLS[diverged]}${GIT_STATUS[ahead]}/${GIT_STATUS[behind]}${RESET}" ;;
+ "10") output+="${BOLD}${GREEN}${GIT_SYMBOLS[ahead]}${GIT_STATUS[ahead]}${RESET}" ;;
+ "01") output+="${BOLD}${RED}${GIT_SYMBOLS[behind]}${GIT_STATUS[behind]}${RESET}" ;;
+ "00") ;; # Clean state, no additional symbol needed
+ esac
+ else
+ # No upstream - show no-upstream indicator
+ output+="${BOLD}${PURPLE}${GIT_SYMBOLS[no_upstream]}${RESET}"
fi
# File status indicators with semantic colors
diff --git a/hyperterm/hyperterm.sha512 b/hyperterm/hyperterm.sha512
index c8bf676..497eecd 100644
--- a/hyperterm/hyperterm.sha512
+++ b/hyperterm/hyperterm.sha512
@@ -2,7 +2,7 @@ cdfe049ec07f02a1893cda29c13085d06709e09a30b0c2e1111585278315f03139d61080c883cb3f
f363606f41a2c2c8f1cc44110c64fe23b1c8feb4c788ee006222db0f5c7a3adeac2b0948626b313adc985e9b8d303a0b9ce1c5ba42746810accb54efddcd4b84 ./hyperterm.sh
b760a908a3f6222b974abc1f7464bde0f5427f120f1e7ef1c6d97ae61769e552ef3b5cb88e193e955da72a592f07eadb812413dd50a691cd3dbb33e3da581ea6 ./core/update.sh
1cfba599047d84a17ff92b695ebf527a505a30acc9ec21a2b9f410a7ea6dde4b23b5cf62e557d82f2fe9a8980649942424b879ca53baae4d4cb3057681baa7b6 ./core/colors.sh
-9d5920540d17873ea79d8737d3450c3de895b1f4820d3fa4e09c03179ef6360960796340e65da8c397840749d5655e345b7aec41ea7c320659454b335e833ac8 ./core/git.sh
+c5ae12ee08361d1264fde5c73868fd0a80fd8810ac4e614cc333335679ad68d629d9bb88a04d27a8002d62f454105f1168df9ea63c7300c9272380b6d5311278 ./core/git.sh
f3e00b2aa8ab9f3ab44570adaa2520408ed66fd00f551654d60b64a4be3546ec781b7efa39bcd774937e654b6ffb4c7af3f21eeb36caf9c01f82f85cf28e2b4d ./core/languages.sh
b205de01644af11ef1dc96230e4bf12087482e26b7c0472fb6a153bf94662e4dfc01b2da0c3ca0da4af93bce05faf0e33be5422fbee85e6b69ca1cccbe194cff ./core/autodep.sh
7447d3e167ab207d3ef4218e201a06bf5a3fc23281639f16f7f405f1d66b73923845d450fdb0a94672757866a9da0324f728564a1b61b2ed1678fe576eb565cf ./core/autocomplete.sh