fix(shell): check git repo before running git commands to prevent TCC prompts (#1677)
Co-authored-by: BillionClaw <billionclaw@users.noreply.github.com>
This commit is contained in:
parent
e0c301b277
commit
af45c421e9
2 changed files with 5 additions and 0 deletions
|
|
@ -451,6 +451,8 @@ _cmux_prompt_command() {
|
|||
_CMUX_GIT_LAST_PWD="$pwd"
|
||||
_CMUX_GIT_LAST_RUN=$now
|
||||
{
|
||||
# Skip git operations if not in a git repository to avoid TCC prompts
|
||||
git rev-parse --git-dir >/dev/null 2>&1 || return 0
|
||||
local branch dirty_opt=""
|
||||
branch=$(git branch --show-current 2>/dev/null)
|
||||
if [[ -n "$branch" ]]; then
|
||||
|
|
|
|||
|
|
@ -236,6 +236,9 @@ _cmux_report_git_branch_for_path() {
|
|||
[[ -n "$CMUX_TAB_ID" ]] || return 0
|
||||
[[ -n "$CMUX_PANEL_ID" ]] || return 0
|
||||
|
||||
# Skip git operations if not in a git repository to avoid TCC prompts
|
||||
git -C "$repo_path" rev-parse --git-dir >/dev/null 2>&1 || return 0
|
||||
|
||||
local branch dirty_opt="" first
|
||||
branch="$(git -C "$repo_path" branch --show-current 2>/dev/null)"
|
||||
if [[ -n "$branch" ]]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue