Conversation
setup_tmux unconditionally cloned five plugin repos. On a second run each clone failed with 'already exists and is not an empty directory', and because the function body was a () subshell under 'set -Eeu' the non-zero exit aborted the entire script -- contradicting the README's claim that setup is safe to run multiple times. Add a clone_or_pull helper that clones when absent and pulls when present, and use it for the tmux plugins, prezto, zsh-autosuggestions and fzf-tab. setup_tmux no longer needs to be a subshell now that the clone destinations are absolute rather than relative to a cd. Also use 'ln -sf' for the prezto runcom symlinks, which otherwise fail if the link already exists. Note: setup_zsh_with_prezto still returns early when $ZPREZTODIR exists, so a run interrupted partway through that function is not yet self-healing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
clone_or_pull still fails or behaves inconsistently in rerun scenarios (existing non-git destinations and submodule checkouts not being updated on pull).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Makes the setup script safer to re-run by avoiding failing git clone operations when repositories already exist, and by making tmux setup independent of cd/subshell behavior.
Changes:
- Adds a
clone_or_pullhelper to clone missing repos and update existing ones. - Updates zsh/prezto, zsh-autosuggestions, fzf-tab, and tmux plugin installs to use
clone_or_pull. - Makes prezto runcom symlink creation idempotent (
ln -sf) and convertssetup_tmuxfrom a subshell to a normal function.
File summaries
| File | Description |
|---|---|
setup |
Introduces clone_or_pull and refactors multiple plugin install steps to be re-runnable without failing on existing directories/symlinks. |
Review details
Suppressed comments (1)
setup:235
clone_or_pullsupports--recursivefor the initial clone, but the update path only runsgit pull. For repos with submodules (e.g. prezto), rerunning the script can update the superproject without updating submodule working trees, leaving the checkout inconsistent. Consider updating submodules after a successful pull when a.gitmodulesfile is present.
info "updating $(basename "$dest")"
# don't abort the run if the checkout is dirty or has no upstream
git -C "$dest" pull --ff-only ||:
else
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+231
to
+238
| if [[ -d "$dest/.git" ]]; then | ||
| info "updating $(basename "$dest")" | ||
| # don't abort the run if the checkout is dirty or has no upstream | ||
| git -C "$dest" pull --ff-only ||: | ||
| else | ||
| info "cloning $(basename "$dest")" | ||
| git clone "$@" "$url" "$dest" | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
setup_tmux unconditionally cloned five plugin repos. On a second run
each clone failed with 'already exists and is not an empty directory',
and because the function body was a () subshell under 'set -Eeu' the
non-zero exit aborted the entire script -- contradicting the README's
claim that setup is safe to run multiple times.
Add a clone_or_pull helper that clones when absent and pulls when
present, and use it for the tmux plugins, prezto, zsh-autosuggestions
and fzf-tab. setup_tmux no longer needs to be a subshell now that the
clone destinations are absolute rather than relative to a cd.
Also use 'ln -sf' for the prezto runcom symlinks, which otherwise fail
if the link already exists.
Note: setup_zsh_with_prezto still returns early when $ZPREZTODIR
exists, so a run interrupted partway through that function is not yet
self-healing.
🤖 Generated with Claude Code