Skip to content

Commit 2f64a74

Browse files
committed
fix(init): pull dotfiles in bootstrap before running setup script
The merge --ff-only fix in common.sh cannot take effect when the local dotfiles are at an older commit that predates the fix (chicken-and-egg). Since bootstrap is always fetched fresh from GitHub, pulling here guarantees the setup script and Brewfiles are up to date.
1 parent 8b6dada commit 2f64a74

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

bin/init/bootstrap-macos.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,14 @@ if [ "$(uname -m)" = "arm64" ] && ! /usr/bin/pgrep -q oahd; then
2727
sudo softwareupdate --install-rosetta --agree-to-license
2828
fi
2929

30-
# Clone dotfiles if missing.
30+
# Clone or update dotfiles so macos.sh always runs the latest code.
3131
if [ ! -d "$DOTFILES_DIR" ]; then
3232
printf "Cloning dotfiles...\n"
3333
git clone https://github.com/ebkn/dotfiles "$DOTFILES_DIR"
34+
else
35+
printf "Updating dotfiles...\n"
36+
git -C "$DOTFILES_DIR" fetch --all --prune
37+
git -C "$DOTFILES_DIR" merge --ff-only || printf "warning: could not fast-forward dotfiles\n" >&2
3438
fi
3539

3640
exec zsh "${DOTFILES_DIR}/bin/init/macos.sh"

bin/init/bootstrap-ubuntu.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ if ! command -v git >/dev/null 2>&1; then
1818
sudo apt install -y git
1919
fi
2020

21-
# Clone dotfiles if missing.
21+
# Clone or update dotfiles so ubuntu.sh always runs the latest code.
2222
if [ ! -d "$DOTFILES_DIR" ]; then
2323
printf "Cloning dotfiles...\n"
2424
git clone https://github.com/ebkn/dotfiles "$DOTFILES_DIR"
25+
else
26+
printf "Updating dotfiles...\n"
27+
git -C "$DOTFILES_DIR" fetch --all --prune
28+
git -C "$DOTFILES_DIR" merge --ff-only || printf "warning: could not fast-forward dotfiles\n" >&2
2529
fi
2630

2731
exec bash "${DOTFILES_DIR}/bin/init/ubuntu.sh"

0 commit comments

Comments
 (0)