From c8d9ca529ab1569fd6622bc229fd0a4c3c370a80 Mon Sep 17 00:00:00 2001 From: Bryan Ramos Date: Mon, 9 Mar 2026 22:16:23 -0400 Subject: [PATCH] added git wrapper to invalidate cache on repo creating cmds --- prompt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/prompt b/prompt index 51dc17c..84f97b1 100644 --- a/prompt +++ b/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"