Skip to content

Five PRs from my breezier branch that ghthor recommended I open here :) - #371

Merged
ghthor merged 11 commits into
scmbreeze:mainfrom
mmcrockett:breezier
Jul 23, 2026
Merged

ghthor merged 11 commits into
scmbreeze:mainfrom
mmcrockett:breezier

Conversation

@mmcrockett

@mmcrockett mmcrockett commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Problem

I wanted to get git worktrees into an scm breez-ish way and along the way I found a bug-ish thing in interactions between ClaudeCode and scm breeze and also added some niceties to the repo.

What

  • Full worktree support in scm breezish way - gwt gwta gwtr aliases, you can pass gco 2 and it knows to cd to the directory for you
  • Concept of worktree sibling or feature or just a different directory you want as default instead of git defaulting to directory you're in (more documentation near the setting in code)
  • Non-private _ fns moved to __ to help with a ClaudeCode quirk
  • Docker 'testing' helper so I could isolate from my local scrips more easily - helps with multiple shell types (bash and zsh) testing
  • Pulled in an outstanding fix for git rev-parse --show-toplevel
  • Fixed several worktree bugs in scm breeze, ie. Fix autocd support for git worktrees #364 is accidentally fixed by my refactors and I also intentionally fixed where a / in the name didn't work correctly.

Why

  • I'm using worktrees more with ai and I love scm breeze features/shortcuts etc
  • I'm annoyed with worktree default of being in the current directory - it just isn't how my brain wants it organized and thought maybe others felt this way
  • I spent a lot of time debugging ClaudeCode not being able to call my ls and cat because I wrapped in the super helpful _scmb_git_branch_shortcuts but ClaudeCode ignores all single _ fns and it caused a lot of pain so I renamed only the fns that are used in a non-private way to have __ in front.
  • I was having trouble testing local b/c I couldn't tell if a quirk was in my extra shell fns or in scm breeze so created a docker tester to help - also helpful it supports bash and zsh so you can easily test different shells
  • I just saw Support for worktrees in old shell functions #365 and seemed reasonable to pull in to my fork
  • Bugs are annoying!

Summary by CodeRabbit

  • New Features
    • Added a Docker sandbox for trying the tool in an isolated environment, with build/run instructions and an included shell session.
    • Added shortcuts for working with git worktrees, including creating, removing, and switching more naturally between branches and their worktrees.
  • Bug Fixes
    • Improved path handling for status-related shortcuts so file paths resolve from the correct project root.
  • Documentation
    • Expanded the README with a new Docker sandbox section.
  • Tests
    • Updated coverage to match the improved command evaluation behavior.

mmcrockett and others added 11 commits June 29, 2026 13:01
…rivate

Fix ClaudeCode ignoring _ functions as "private"
…de-git-checkout

Improve worktree inside git checkout.
…late

Mcrockett/gwt alias and pr template
* Improve worktree inside git checkout.

* Add gwt alias, pr template.

* Checkout handles worktree branch name.

* Add docker test area.
* Checkout handles worktree branch name.

* git worktree add with a touch more functionality.

* More aliases

* Correct merge

* Fix for / in branch name

* Break out internal _scmb_git fn

* worktree remove handles branch name

* Add number support generally to worktree

* Fix ClaudeCode ignoring _ functions as "private"

* Cleanup...

* Remove duplicate functions.

* split some functions.
The ruby version moved some time ago to --show-toplevel....

Co-authored-by: Russell Mora <russell.mora@nokia.com>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds git worktree shortcut support (checkout, add, remove) with new aliases and helper functions, renames the internal _safe_eval helper to __safe_eval across implementation and tests, fixes project root detection, adds a Docker-based sandbox environment with documentation, and updates the pull request template.

Changes

Git worktree shortcuts and safe-eval rename

Layer / File(s) Summary
Plain-name helper and safe-eval rename
lib/git/helpers.sh, lib/scm_breeze.sh, lib/git/status_shortcuts.sh, test/lib/scm_breeze_test.sh
Adds __scmb_is_plain_name predicate and renames _safe_eval to __safe_eval across implementation, a caller, and tests.
Git command dispatch refactor and alias wiring
lib/git/aliases.sh
Extracts git() dispatch logic into __scmb_git() and wires new __git_alias entries for worktree, worktree add, worktree remove.
Worktree lookup, target path, and add/remove implementation
lib/git/branch_shortcuts.sh
Adds helpers to locate worktrees by branch, compute target paths, create worktrees, and implements gwt/checkout shortcut behavior with fallback to native git.
Status shortcut project root fix
lib/git/fallback/status_shortcuts_shell.sh
Computes project_root via git rev-parse --show-toplevel instead of stripping .git from git-dir output.
Worktree alias configuration example
git.scmbrc.example
Adds git_worktree_alias, git_worktree_directory, git_worktree_add_alias, git_worktree_remove_alias config entries with documentation.

Docker sandbox environment

Layer / File(s) Summary
Sandbox Dockerfile
docker/Dockerfile
Adds Alpine-based image installing tooling, creating a dev user, setting git identity, and configuring the entrypoint.
Sandbox entrypoint script
docker/entrypoint.sh
Runs /workspace/install.sh once, creates a throwaway sandbox git repo, prints a usage banner, and execs the provided command.
README Docker sandbox documentation
README.md
Adds a table of contents entry and documentation section describing sandbox build/run/test commands.
Pull request template update
pull_request_template.md
Adds Problem/What/Why sections with placeholder content.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CheckoutShortcuts as __scmb_git_checkout_shortcuts
  participant WorktreeLookup as __scmb_git_worktree_path_for_branch
  participant GitCLI as git

  User->>CheckoutShortcuts: git co feature-branch
  CheckoutShortcuts->>WorktreeLookup: find worktree for feature-branch
  WorktreeLookup->>GitCLI: git worktree list --porcelain
  GitCLI-->>WorktreeLookup: worktree paths
  alt worktree exists
    WorktreeLookup-->>CheckoutShortcuts: path
    CheckoutShortcuts->>CheckoutShortcuts: cd into worktree
  else no worktree
    CheckoutShortcuts->>GitCLI: __safe_eval git checkout feature-branch
  end
Loading
sequenceDiagram
  participant User
  participant DockerCLI as docker
  participant Entrypoint as entrypoint.sh
  participant SandboxRepo as sandbox-repo

  User->>DockerCLI: docker run scm-breeze-sandbox
  DockerCLI->>Entrypoint: exec entrypoint.sh bash
  Entrypoint->>Entrypoint: run /workspace/install.sh once
  Entrypoint->>SandboxRepo: init throwaway git repo if missing
  Entrypoint->>User: print usage banner
  Entrypoint->>DockerCLI: exec "$@" (bash)
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is vague and does not describe the work in this changeset. Replace it with a concise summary of the main change, such as worktree support and Docker sandbox additions.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mmcrockett
mmcrockett marked this pull request as draft July 2, 2026 14:52
@mmcrockett

Copy link
Copy Markdown
Contributor Author

I still need to test whether ghthor comment to me "https://github.com/mmcrockett/scm_breeze/blob/67a45317f46a4c2af62bb742b5a51d42e31056a7/lib/git/branch_shortcuts.sh#L65 - Does this result in an args value being added to the shell env?"

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
git.scmbrc.example (1)

112-120: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Missing feature mode in git_worktree_directory docs.

The comment documents "", "sibling", and an explicit directory path, but the implementation (__scmb_git_worktree_target_path in lib/git/branch_shortcuts.sh) also supports a "feature" mode that nests the repo's worktree inside a <name> directory. Users configuring this file have no way to discover that option.

📝 Proposed doc fix
 git_worktree_alias="gwt"
 # Controls where `gwt add <name>` places the new worktree.
 #   ""           (default) - pass through to native `git worktree add`
 #   "sibling"              - create "<repo-basename>-<name>" next to the repo
+#   "feature"              - create "<name>/<repo-basename>" next to the repo,
+#                            nesting the worktree so multiple repos can share
+#                            one feature directory
 #   "/some/dir"            - create "/some/dir/<repo-basename>-<name>"
 # In all non-empty modes the new branch is named <name>.
 git_worktree_directory=""
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@git.scmbrc.example` around lines 112 - 120, Update the git_worktree_directory
documentation comment to include the supported "feature" mode alongside "",
"sibling", and explicit paths. Reference the existing git_worktree_directory
setting and keep the description aligned with __scmb_git_worktree_target_path in
lib/git/branch_shortcuts.sh so users can discover that <name>/<repo-basename>
worktree layout option.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docker/Dockerfile`:
- Around line 3-15: The Dockerfile package install step will fail because
`shunit2` is in Alpine’s community repository, not main. Update the `RUN apk add
--no-cache` block in the Dockerfile to enable the Alpine community repo before
installing packages, then keep the existing package list including `shunit2`
unchanged. Use the same Dockerfile install section so the repo is configured
prior to the `apk add` call.

In `@docker/entrypoint.sh`:
- Around line 4-11: The install flow in entrypoint.sh is marking scm_breeze as
installed even when /workspace/install.sh fails, because the failure is
swallowed and the marker is touched unconditionally. Update the logic around the
/workspace/install.sh invocation so the .scm_breeze_installed file is only
created after a successful install, and keep the existing warning path for
missing /workspace/install.sh; use the install block itself as the place to gate
the touch so failures in the entrypoint do not suppress future retries.
- Around line 13-25: The sandbox setup in entrypoint.sh creates only an unstaged
README.md edit and an untracked file, so it does not match the documented
staged/unstaged/untracked state. Update the setup in the sandbox-repo
initialization block to leave one file staged after the initial commit, using
the existing git init/git add/git commit flow and the README.md/new.txt setup as
the anchor points. Make sure the final repo state includes a staged change in
addition to the current unstaged modification and untracked file.

In `@README.md`:
- Around line 69-71: The README wording is out of sync with the sandbox setup
created by docker/entrypoint.sh: it should not claim the repo is pre-populated
with staged changes if the entrypoint only creates an unstaged modification and
an untracked file. Update the documentation text to match the actual behavior
produced by the entrypoint script, and use the same terminology as the setup
logic so the description stays accurate if the script changes.

---

Nitpick comments:
In `@git.scmbrc.example`:
- Around line 112-120: Update the git_worktree_directory documentation comment
to include the supported "feature" mode alongside "", "sibling", and explicit
paths. Reference the existing git_worktree_directory setting and keep the
description aligned with __scmb_git_worktree_target_path in
lib/git/branch_shortcuts.sh so users can discover that <name>/<repo-basename>
worktree layout option.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 59f05bb0-a298-4fe6-8530-b1b9a37b5f5c

📥 Commits

Reviewing files that changed from the base of the PR and between 2d17ef5 and 67a4531.

📒 Files selected for processing (12)
  • README.md
  • docker/Dockerfile
  • docker/entrypoint.sh
  • git.scmbrc.example
  • lib/git/aliases.sh
  • lib/git/branch_shortcuts.sh
  • lib/git/fallback/status_shortcuts_shell.sh
  • lib/git/helpers.sh
  • lib/git/status_shortcuts.sh
  • lib/scm_breeze.sh
  • pull_request_template.md
  • test/lib/scm_breeze_test.sh

Comment thread docker/Dockerfile
Comment thread docker/entrypoint.sh
Comment thread docker/entrypoint.sh
Comment thread README.md
@ghthor
ghthor marked this pull request as ready for review July 23, 2026 20:55
@ghthor
ghthor merged commit b57798b into scmbreeze:main Jul 23, 2026
5 checks passed
@mmcrockett

Copy link
Copy Markdown
Contributor Author

Thanks for merging ghthor - sorry been lost in other stuff and haven't tested your suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants