Add pull step back to git-sync-all.sh

Pulls ~/.emacs.d/ and ~/.config/home-manager/
This commit is contained in:
Evie Litherland-Smith 2024-06-07 06:01:43 +01:00
parent fd35f72cd2
commit 0e45bbe456

View file

@ -1,16 +1,27 @@
# Clone ~/.emacs.d/ if it doesn't exist, pull otherwise (ff only)
DIRECTORY="$HOME/.emacs.d/"
URL="https://git.xenia.me.uk/pixelifytica/emacs.git"
echo "--- ~/.emacs.d/ ---"
if [ ! -d "$DIRECTORY" ]; then
# Clone ~/.emacs.d/ and ~/.config/home-manager if then don't exist,
# pull otherwise (ff only)
PULL_DIRS=(
"$HOME/.emacs.d/"
"${XDG_CONFIG_HOME:-$HOME/.config}/home-manager"
)
PULL_URLS=(
"https://git.xenia.me.uk/pixelifytica/emacs.git"
"https://git.xenia.me.uk/pixelifytica/home-manager.git"
)
for i in "${!PULL_DIRS[@]}"; do
DIRECTORY="${PULL_DIRS[$i]}"
URL="${PULL_URLS[$i]}"
echo "--- $DIRECTORY ---"
if [ ! -d "$DIRECTORY" ]; then
git clone "$URL" "$DIRECTORY"
fi
(
fi
(
cd "$DIRECTORY" || exit
git remote set-url origin "$URL"
git pull --ff --ff-only
git status --porcelain
)
)
done
# Sync common directories, setting url to ensure it's up-to-date first
SYNC_DIRS=(