mirror of
https://github.com/itme-brain/bash.git
synced 2026-03-23 17:59:44 -04:00
added git wrapper to invalidate cache on repo creating cmds
This commit is contained in:
parent
100b851ee5
commit
c8d9ca529a
1 changed files with 9 additions and 1 deletions
10
prompt
10
prompt
|
|
@ -155,9 +155,17 @@ _set_prompt() {
|
|||
PS1="$_ssh_PS1\n$working_dir\n$venv_icons$_green_arrow$git_branch_PS1$_white_text"
|
||||
}
|
||||
|
||||
# Invalidate cache (call after git clone, init, etc)
|
||||
# Invalidate cache for current directory
|
||||
_prompt_cache_invalidate() {
|
||||
unset "_dir_cache[$PWD]"
|
||||
}
|
||||
|
||||
# Wrap git to invalidate cache on repo-creating commands
|
||||
git() {
|
||||
command git "$@"
|
||||
local ret=$?
|
||||
[[ "$1" =~ ^(init|clone)$ ]] && _prompt_cache_invalidate
|
||||
return $ret
|
||||
}
|
||||
|
||||
PROMPT_COMMAND="_set_prompt"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue