fix stash: only pop if we actually stashed
This commit is contained in:
parent
83f95e1f3f
commit
369181e705
@ -46,9 +46,13 @@ if [ -d "$NVIM_CONFIG/.git" ]; then
|
|||||||
EXISTING_REMOTE=$(git -C "$NVIM_CONFIG" remote get-url "$REMOTE_NAME" 2>/dev/null || echo "")
|
EXISTING_REMOTE=$(git -C "$NVIM_CONFIG" remote get-url "$REMOTE_NAME" 2>/dev/null || echo "")
|
||||||
if [ "$EXISTING_REMOTE" = "$REPO" ]; then
|
if [ "$EXISTING_REMOTE" = "$REPO" ]; then
|
||||||
echo "NvChad config already installed — pulling latest..."
|
echo "NvChad config already installed — pulling latest..."
|
||||||
|
local stashed=false
|
||||||
|
if ! git -C "$NVIM_CONFIG" diff --quiet || ! git -C "$NVIM_CONFIG" diff --cached --quiet; then
|
||||||
git -C "$NVIM_CONFIG" stash
|
git -C "$NVIM_CONFIG" stash
|
||||||
|
stashed=true
|
||||||
|
fi
|
||||||
git -C "$NVIM_CONFIG" pull "$REMOTE_NAME" "$BRANCH"
|
git -C "$NVIM_CONFIG" pull "$REMOTE_NAME" "$BRANCH"
|
||||||
git -C "$NVIM_CONFIG" stash pop 2>/dev/null || true
|
$stashed && git -C "$NVIM_CONFIG" stash pop || true
|
||||||
deploy_nvim
|
deploy_nvim
|
||||||
echo "Done."
|
echo "Done."
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user