From 73e65fad956c71349813452d595b3dfc5c57dd3b Mon Sep 17 00:00:00 2001 From: Chip Hogg Date: Wed, 3 Dec 2025 19:44:58 -0500 Subject: [PATCH 1/2] Permit opting out of branch name truncation Users can now add this line before sourcing the script: ```bash export GITSTATUS_USE_FULL_BRANCH_NAME=1 ``` If they do, branch names will not be truncated, no matter their length. Fixes #481. --- gitstatus.prompt.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gitstatus.prompt.sh b/gitstatus.prompt.sh index f54c11a..05f1955 100644 --- a/gitstatus.prompt.sh +++ b/gitstatus.prompt.sh @@ -52,7 +52,16 @@ function gitstatus_prompt_update() { where="${VCS_STATUS_COMMIT:0:8}" fi - (( ${#where} > 32 )) && where="${where:0:12}…${where: -12}" # truncate long branch names and tags + # Truncate long branch names and tags. + # + # To opt out of truncation, add this line to your `.bashrc` before sourcing + # this script: + # + # export GITSTATUS_USE_FULL_BRANCH_NAME=1 + if [[ -z "${GITSTATUS_USE_FULL_BRANCH_NAME-}" ]]; then + (( ${#where} > 32 )) && where="${where:0:12}…${where: -12}" + fi + p+="${clean}${where}" # ⇣42 if behind the remote. From 2fe401d0089cb85c103be9317810b9cac8df6d46 Mon Sep 17 00:00:00 2001 From: Chip Hogg Date: Wed, 3 Dec 2025 19:49:51 -0500 Subject: [PATCH 2/2] Update README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 609d5f8..ca23cdc 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,16 @@ script that uses these bindings to assemble git prompt. Note: Bash bindings, unlike Zsh bindings, don't support asynchronous calls. +Note: Even the above customization method won't prevent gitstatus from truncating the branch name +that is displayed in the prompt. To disable truncation, add this line in your `.bashrc` before +sourcing any gitstatus script: + +```bash +export GITSTATUS_USE_FULL_BRANCH_NAME=1 +``` + +This method will work for both customized prompts, and the default prompt. + ## Using from other shells If there are no gitstatusd bindings for your shell, you'll need to get your hands dirty.