You've already forked bash-git-prompt
comment corrections only no code changes
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
# Author : Allan Christensen
|
||||
# First Created : 24062025 (DD-MM-YYYY)
|
||||
# Description : Bash Git prompt for Linux
|
||||
# License : MIT License
|
||||
|
||||
# Default to theme 1 if not set
|
||||
#
|
||||
# Set default theme to 1 if it's not already set
|
||||
#
|
||||
GIT_PROMPT_THEME="${GIT_PROMPT_THEME:-1}"
|
||||
|
||||
# -------------------------------
|
||||
# THEME ICON DEFINITIONS
|
||||
# -------------------------------
|
||||
#
|
||||
# Theme icon definitions
|
||||
#
|
||||
set_git_prompt_theme_icons() {
|
||||
case "$GIT_PROMPT_THEME" in
|
||||
2|3)
|
||||
@@ -69,9 +69,9 @@ set_git_prompt_theme_icons() {
|
||||
}
|
||||
set_git_prompt_theme_icons
|
||||
|
||||
# -------------------------------
|
||||
# CACHING SETUP
|
||||
# -------------------------------
|
||||
#
|
||||
# Caching configuration and setup
|
||||
#
|
||||
GIT_CACHE_FILE="/tmp/git_prompt_cache.$$"
|
||||
|
||||
# Collected state variables
|
||||
@@ -81,7 +81,7 @@ GIT_STATE_STASH_LIST=""
|
||||
GIT_STATE_UNTRACKED=""
|
||||
GIT_STATE_FINGERPRINT=""
|
||||
|
||||
# Directories to skip for speed (Option 2A)
|
||||
# Directories to skip for speed
|
||||
HEAVY_DIRS=(
|
||||
node_modules
|
||||
vendor
|
||||
@@ -95,9 +95,9 @@ HEAVY_DIRS=(
|
||||
.cache
|
||||
)
|
||||
|
||||
# -------------------------------
|
||||
# SMART STATE COLLECTION (Option 1B + 2A)
|
||||
# -------------------------------
|
||||
#
|
||||
# Curent state collection
|
||||
#
|
||||
git_collect_state() {
|
||||
|
||||
# HEAD
|
||||
@@ -109,12 +109,12 @@ git_collect_state() {
|
||||
# Stash list
|
||||
GIT_STATE_STASH_LIST=$(GIT_OPTIONAL_LOCKS=0 git stash list 2>/dev/null || true)
|
||||
|
||||
# Smart untracked detection (Option 1B)
|
||||
# Smart untracked detection
|
||||
# Much faster than git status because it only lists untracked, not modified
|
||||
local untracked_raw
|
||||
untracked_raw=$(git ls-files --others --exclude-standard 2>/dev/null || true)
|
||||
|
||||
# Apply directory skipping (Option 2A)
|
||||
# Apply directory skipping
|
||||
GIT_STATE_UNTRACKED=""
|
||||
while IFS= read -r f; do
|
||||
skip=0
|
||||
@@ -142,9 +142,9 @@ git_collect_state() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# -------------------------------
|
||||
# RENDER LOGIC
|
||||
# -------------------------------
|
||||
#
|
||||
# Render logic
|
||||
#
|
||||
actual_git_prompt_info_logic() {
|
||||
|
||||
local branch
|
||||
@@ -174,9 +174,9 @@ actual_git_prompt_info_logic() {
|
||||
is_clean=0
|
||||
(( staged == 0 && conflicts == 0 && changed == 0 && untracked == 0 )) && is_clean=1
|
||||
|
||||
# -------------------------
|
||||
# (Themes kept as-is)
|
||||
# -------------------------
|
||||
#
|
||||
# Render themes
|
||||
#
|
||||
if [[ "$GIT_PROMPT_THEME" == "2" ]]; then
|
||||
printf "\[\e[30;44m\]"
|
||||
printf "\[\e[97;44m\] %s%s " "$BRANCH_ICON" "$branch"
|
||||
@@ -223,9 +223,9 @@ actual_git_prompt_info_logic() {
|
||||
fi
|
||||
}
|
||||
|
||||
# -------------------------------
|
||||
# MAIN PROMPT LOGIC
|
||||
# -------------------------------
|
||||
#
|
||||
# Main prompt logic
|
||||
#
|
||||
git_prompt_info() {
|
||||
git rev-parse --is-inside-work-tree &>/dev/null || return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user