mirror of
https://github.com/Myzel394/zsh-copilot.git
synced 2025-06-18 20:55:26 +02:00
fix: Detect if in git workspace before attempting to get git diff
This commit is contained in:
parent
f3ed362db8
commit
ca82cb2d62
@ -22,10 +22,12 @@ function _suggest_ai() {
|
|||||||
|
|
||||||
local PROMPT="$SYSTEM_PROMPT"
|
local PROMPT="$SYSTEM_PROMPT"
|
||||||
if [[ "$ZSH_COPILOT_SEND_GIT_DIFF" == 'true' ]]; then
|
if [[ "$ZSH_COPILOT_SEND_GIT_DIFF" == 'true' ]]; then
|
||||||
local git_diff=$(git diff --no-color | xargs | sed 's/ /\$/g' | xargs | sed 's/ /$/g')
|
if [[ "git rev-parse --is-inside-work-tree" == 'true' ]]; then
|
||||||
|
local git_diff=$(git diff --no-color | xargs | sed 's/ /\$/g' | xargs | sed 's/ /$/g')
|
||||||
|
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
PROMPT="$PROMPT; This is the git diff (newlines separated by dollar signs): $git_diff;; You may provide a git commit message if the user is trying to commit changes. Do not say something like 'Your commit message' or 'Your commit message here'. Just provide the commit message."
|
PROMPT="$PROMPT; This is the git diff (newlines separated by dollar signs): $git_diff;; You may provide a git commit message if the user is trying to commit changes. Do not say something like 'Your commit message' or 'Your commit message here'. Just provide the commit message."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user