From cf7be9c369a2ec1de2509cbed7bc28f30a27febd Mon Sep 17 00:00:00 2001 From: CI Date: Sat, 25 Jul 2026 17:03:17 -0400 Subject: [PATCH 1/2] Address CodeRabbit findings before the v1.0.0 merge. Roll back init when AGENTS.md seeding fails, drop uninstall, tighten docs and smoke isolation, and assert --no-push actually creates the worktree. Co-authored-by: Cursor --- README.md | 18 ++++-------------- git-trees | 6 +++++- install.sh | 32 -------------------------------- tests/smoke.sh | 14 +++++++++++--- 4 files changed, 20 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 75c41ca..cd05377 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ does, you could do with `git worktree` by hand. `init` and `add` produce different things — the container first, working copies after: -``` +```text After `git trees init`: After `git trees add feature-x`: some-repo/ some-repo/ @@ -120,6 +120,7 @@ cd git-trees && ./install.sh # → ~/.local/bin **Convenience — one-line curl.** Fetches only the script: ```bash +mkdir -p ~/.local/bin curl -o ~/.local/bin/git-trees \ https://raw.githubusercontent.com/brightdigit/git-trees/v1.0.0/git-trees chmod +x ~/.local/bin/git-trees @@ -145,17 +146,6 @@ case ":$PATH:" in *":$HOME/.local/bin:"*) ;; *) `install.sh` warns if it isn't; the curl path cannot. Anything on `PATH` named `git-trees` becomes `git trees`. -### Uninstall - -```bash -./install.sh --uninstall # clears ~/.local/bin and /usr/local/bin -./install.sh --uninstall /opt/bin # or the prefix you installed to -``` - -Pass the same directory you installed to — without it, a custom-prefix install is -left behind. Uninstall does **not** remove `~/.config/git-trees/AGENTS.md`; it -says so, and you can delete it yourself. - ## Configuration All three variables are optional. Add to `~/.zshrc` (or `~/.bashrc`): @@ -220,8 +210,8 @@ Creates a worktree, handling three cases: | Branch exists on `origin` | Fetch, create with `--track` | | Branch is new | Create from `base` (default `origin/`) with `--no-track` | -> **`add` writes to the remote.** Upstream is always set afterward via `track`. -> If the branch does not exist on `origin`, that runs +> **`add` writes to the remote by default.** When pushing is enabled, upstream is +> set afterward via `track`. If the branch does not exist on `origin`, that runs > `git push -u origin HEAD` — **which creates the branch on the remote.** This > is a reasonable default for parallel coding agents, which need an upstream to > push to, but it means a local-feeling command fires CI, sends notifications, diff --git a/git-trees b/git-trees index 120f355..b8536f8 100755 --- a/git-trees +++ b/git-trees @@ -238,7 +238,11 @@ cmd_init() { # Optional: fails harmlessly against a remote with no HEAD. git -C "$dir" remote set-head origin --auto >/dev/null 2>&1 - _seed_agents "$dir" || return 1 + if ! _seed_agents "$dir"; then + echo "git trees init: could not seed AGENTS.md — removing $dir" >&2 + rm -rf "$dir" + return 1 + fi local def def=$(cd "$dir" && _default_branch) diff --git a/install.sh b/install.sh index f1bdd27..8f13374 100755 --- a/install.sh +++ b/install.sh @@ -3,44 +3,12 @@ # # ./install.sh install to ~/.local/bin # ./install.sh /usr/local/bin install elsewhere -# ./install.sh --uninstall remove from the two default locations -# ./install.sh --uninstall /opt/bin remove from the prefix you installed to set -uo pipefail SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" CFG="$HOME/.config/git-trees" -if [ "${1:-}" = "--uninstall" ]; then - # Honor the same DEST as install. Without an argument, sweep the two defaults; - # a custom-prefix install would otherwise be left behind silently. - if [ -n "${2:-}" ]; then - set -- "$2" - else - set -- "$HOME/.local/bin" /usr/local/bin - fi - - removed=0 - for d in "$@"; do - if [ -e "$d/git-trees" ]; then - if rm -f "$d/git-trees"; then - echo "removed $d/git-trees" - removed=1 - fi - fi - done - - if [ "$removed" -eq 0 ]; then - echo "install.sh: no git-trees found in $*" >&2 - echo " if you installed elsewhere, pass it: ./install.sh --uninstall " >&2 - fi - - if [ -e "$CFG/AGENTS.md" ]; then - echo "left $CFG/AGENTS.md in place — remove it yourself if you want it gone" - fi - exit 0 -fi - DEST="${1:-$HOME/.local/bin}" [ -f "$SRC/git-trees" ] || { echo "install.sh: git-trees not found in $SRC" >&2; exit 1; } diff --git a/tests/smoke.sh b/tests/smoke.sh index e8d73c2..a84de23 100755 --- a/tests/smoke.sh +++ b/tests/smoke.sh @@ -91,8 +91,12 @@ assert_no_hang() { # assert_no_hang