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. 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.