From 0e45bbe45651ba7b1c0b11a8fe9e25508933b138 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Fri, 7 Jun 2024 06:01:43 +0100 Subject: [PATCH] Add pull step back to git-sync-all.sh Pulls ~/.emacs.d/ and ~/.config/home-manager/ --- scripts/shell/git-sync-all.sh | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/scripts/shell/git-sync-all.sh b/scripts/shell/git-sync-all.sh index 22bf92c..8b7a8cc 100755 --- a/scripts/shell/git-sync-all.sh +++ b/scripts/shell/git-sync-all.sh @@ -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 - git clone "$URL" "$DIRECTORY" -fi -( - cd "$DIRECTORY" || exit - git remote set-url origin "$URL" - git pull --ff --ff-only - git status --porcelain +# 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 + ( + 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=(