From f82446c9ac29af66fa4dcc056a67fc469dd19385 Mon Sep 17 00:00:00 2001 From: Alan Stebbens Date: Thu, 28 Aug 2014 13:59:33 -0700 Subject: [PATCH 1/2] aks: changed all file envars to end with _FILE; added git_prompt_reset --- gitprompt.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/gitprompt.sh b/gitprompt.sh index ed1a5bbe..6f95df05 100755 --- a/gitprompt.sh +++ b/gitprompt.sh @@ -67,6 +67,18 @@ function gp_maybe_set_envar_to_path(){ return 1 } +# git_prompt_reset +# +# unsets selected GIT_PROMPT variables, causing the next prompt callback to +# recalculate them from scratch. + +git_prompt_reset() { + local var + for var in GIT_PROMPT_DIR __GIT_PROMPT_COLORS_FILE __PROMPT_COLORS_FILE __GIT_STATUS_CMD ; do + unset $var + done +} + function git_prompt_config() { #Checking if root to change output @@ -78,8 +90,8 @@ function git_prompt_config() # prompt-colors.sh -- sets generic color names suitable for bash `PS1` prompt # git-prompt-colors.sh -- sets the GIT_PROMPT color scheme, using names from prompt-colors.sh - if gp_set_file_var __PROMPT_COLORS_SH prompt-colors.sh ; then - source "$__PROMPT_COLORS_SH" # outsource the color defs + if gp_set_file_var __PROMPT_COLORS_FILE prompt-colors.sh ; then + source "$__PROMPT_COLORS_FILE" # outsource the color defs else echo 1>&2 "Cannot find prompt-colors.sh!" fi @@ -220,8 +232,6 @@ function updatePrompt() { local PROMPT_START local PROMPT_END local EMPTY_PROMPT - local GIT_PROMPT_FETCH_TIMEOUT - local __GIT_STATUS_CMD local Blue="\[\033[0;34m\]" git_prompt_config From 1a144e23db83bfb564b61d406fdc4477b8ef9e72 Mon Sep 17 00:00:00 2001 From: Alan Stebbens Date: Thu, 28 Aug 2014 13:59:46 -0700 Subject: [PATCH 2/2] aks: addd git_prompt_reset --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3fa86df0..12abe62a 100644 --- a/README.md +++ b/README.md @@ -128,8 +128,16 @@ GIT_PROMPT_COMMAND_FAIL="${Red}✘-_LAST_COMMAND_STATE_ " # displays as ✘-1 fo on a per repository basis by creating a file named ``.bash-git-rc`` with the content ``FETCH_REMOTE_STATUS=0`` in the root of your git repository. -- You can get help on the git prompt with the function ``git_prompt_help``. - Examples are available with ``git_prompt_examples``. +- You can get help on the git prompt with the function ``git_prompt_help``. + Examples are available with ``git_prompt_examples``. + +- If you make any changes to any file that is sourced by `gitprompt.sh`, you + should run this command, so that the next prompt update will find all the + files and source them anew. + +```sh +git_prompt_reset +``` **Enjoy!**