git-worktrees 0.13.3__tar.gz → 0.13.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/AGENTS.md +42 -14
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/CHANGELOG.md +42 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/PKG-INFO +19 -5
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/README.md +18 -4
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/conf.d/worktrees.fish +1 -1
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/DEVELOPMENT.md +3 -2
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/REFERENCE.md +42 -3
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/commands/fast-forward.md +4 -1
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/commands/list.md +5 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/commands/push.md +10 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/.claude-plugin/plugin.json +1 -1
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/.codex-plugin/plugin.json +1 -1
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/plugin.json +1 -1
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/fast-forward/SKILL.md +2 -1
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/pyproject.toml +1 -1
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/branch_forge.py +13 -2
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/fast_forward.py +9 -5
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/git.py +43 -3
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/merged.py +17 -3
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/pick.py +2 -2
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/pr_merge.py +10 -8
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/progress.py +3 -1
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/prune.py +2 -2
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/push.py +15 -8
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/render.py +25 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/sync.py +109 -24
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/worktree.py +16 -8
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_assessment.py +101 -5
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_fast_forward.py +22 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_gates.py +40 -1
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_push.py +32 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_removal.py +22 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_render.py +19 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_sync.py +119 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/uv.lock +1 -1
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/worktrees.plugin.zsh +1 -1
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/.claude/settings.json +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/.codex/config.toml +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/.github/workflows/codeql.yml +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/.github/workflows/publish.yml +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/.github/workflows/testpypi.yml +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/.github/workflows/tests.yml +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/.gitignore +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/.pre-commit-config.yaml +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/.python-version +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/.releasetools.yaml +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/LICENSE +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/Makefile +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/completions/gw.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/completions/worktrees.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/BENCHMARK.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/commands/add.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/commands/branch-create.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/commands/branch-prune.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/commands/branch-status.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/commands/ci-checks.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/commands/merge.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/commands/preflight.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/commands/stack-link.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/docs/plans/2026-11-05-worktree-pruning-design.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gw.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwa.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwbc.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwbp.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwbs.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwff.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwl.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwm.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwp!.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwp.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwpa!.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwpa.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwpu.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwr!.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwr.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gwrk!.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/functions/gws.fish +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/hatch_build.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/README.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/hooks/codex.json +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/hooks/hooks.json +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/session.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/ci-checks/SKILL.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/describe-pr/SKILL.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/describe-pr/format.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/preflight/SKILL.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/preflight/agents/openai.yaml +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/preflight/config.toml +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/preflight/merge_codex_rules.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/preflight/project.json +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/preflight/rules.json +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/preflight/worktrees.rules +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/prune/SKILL.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/ship-it/SKILL.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/plugin/skills/ship-it/rights.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/renovate.json +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/scripts/README.md +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/scripts/benchmark.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/scripts/bump_version.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/scripts/verify-publish.bash +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/__init__.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/audit.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/branch_cli.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/branches.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/ci.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/cli.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/errors.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/forge.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/layout.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/new_branch.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/preflight.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/repo.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/stack_link.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/src/worktrees/verdicts.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/audit_schema.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/conftest.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_audit.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_benchmark.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_branch_forge.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_branches.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_ci.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_cli.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_command_defaults.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_completions.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_fixture.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_forge.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_git_records.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_new_branch.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_partial_clone.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_path_boundaries.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_plugin.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_pr_merge.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_preflight.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_shims.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_spec.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_stack_link.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_version.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/tests/test_worktree.py +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/completions/_gw +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gw +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwa +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwbc +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwbp +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwbs +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwff +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwl +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwm +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwp +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwp! +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwpa +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwpa! +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwpu +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwr +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwr! +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gwrk! +0 -0
- {git_worktrees-0.13.3 → git_worktrees-0.13.4}/zsh/plugins/worktrees/functions/gws +0 -0
|
@@ -146,7 +146,8 @@ leaves the open request on that finished branch, where a merge never
|
|
|
146
146
|
reaches the head branch. `_retarget` moves its base to the head branch,
|
|
147
147
|
the one forge write `gw fast-forward` makes on its own, and `_publish`
|
|
148
148
|
pushes the branch under a lease once it is level; a branch with an open
|
|
149
|
-
request that dropped a parent's merged commits is pushed the same way
|
|
149
|
+
request that dropped a parent's merged commits is pushed the same way,
|
|
150
|
+
`stash-conflict` included, since only the uncommitted work failed there.
|
|
150
151
|
Commits the finished branch gained after its merge that the head ref
|
|
151
152
|
lacks, by `merged.change_in`, go first: `_rescue` copies them without a
|
|
152
153
|
checkout onto a dated branch from the head ref, pushes it and opens its
|
|
@@ -176,7 +177,9 @@ that neither the branch nor the head ref holds by sha or patch-id, outside
|
|
|
176
177
|
the copy's own `merged.merged_part`. A merge or an empty commit has no
|
|
177
178
|
patch-id in this comparison and stays in that list without another proof.
|
|
178
179
|
Any that `push.made_here` does not find through the branch's reflog is a
|
|
179
|
-
refusal that `--replace` lifts.
|
|
180
|
+
refusal that `--replace` lifts. An entry counts only the commits it made,
|
|
181
|
+
never what it built on: a rebase's `onto` commit, which `git rebase
|
|
182
|
+
origin/BRANCH` makes another clone's tip, and a committed merge's parents. `merged.merged_part` of the branch itself,
|
|
180
183
|
the commits the head ref already has by the proofs `gw prune` reads, is a
|
|
181
184
|
refusal nothing lifts, and names `gw fast-forward`. `--force-if-includes` is not passed: git
|
|
182
185
|
ignores it beside an explicit lease, and the first check asks what it
|
|
@@ -372,8 +375,9 @@ does: the command exits 0 and deletes nothing.
|
|
|
372
375
|
The list is redrawn in place when stderr is a terminal that can move its
|
|
373
376
|
cursor: the cursor climbs over the frame drawn last and erases everything
|
|
374
377
|
under it, since the filter makes the list longer or shorter. The climb counts
|
|
375
|
-
lines, so the frame fits the screen: each row is cut to the terminal's width
|
|
376
|
-
|
|
378
|
+
lines, so the frame fits the screen: each row is cut to the terminal's width
|
|
379
|
+
by `render.fit`, which counts a wide character as two columns and a
|
|
380
|
+
combining mark as none, and the rows shown are a window as tall as the screen that follows the
|
|
377
381
|
highlight. On `TERM=dumb`,
|
|
378
382
|
or a stderr that is not a terminal, the list is printed once, each move
|
|
379
383
|
prints the row it lands on, and each change to the filter prints the rows it
|
|
@@ -497,8 +501,9 @@ call site that formats a table, and neither path passes a code to one.
|
|
|
497
501
|
`progress.py` draws a spinner on stderr and one line per running thread
|
|
498
502
|
saying what it is checking, while `gw sync`, `gw prune`, `gw remove`,
|
|
499
503
|
`gw branch status` and `gw branch prune` assess or mutate. A thread's line
|
|
500
|
-
goes when the thread ends, and every line is cut to the terminal width
|
|
501
|
-
the redraw can count its rows
|
|
504
|
+
goes when the thread ends, and every line is cut to the terminal width by
|
|
505
|
+
`render.fit` so the redraw can count its rows: a branch named in CJK takes
|
|
506
|
+
two columns a character, and cutting it by `len` wraps the line. It runs only when stderr is a terminal that
|
|
502
507
|
can clear a line, and never under `-q` or `-v`, since the verbose log writes
|
|
503
508
|
to the lines it redraws. Anything else printed on stderr while it spins goes
|
|
504
509
|
through `progress.line`, which clears the spinner first.
|
|
@@ -579,11 +584,19 @@ branches. Git refusing a moved tag is a warning; any other refused ref fails
|
|
|
579
584
|
that remote. The fetch runs in the C locale so sync can read which it was. The
|
|
580
585
|
shared `git-worktrees-sync.json` cache in the Git common directory records
|
|
581
586
|
remote name/URL, successful sync times and source-tip forge evidence. Sync
|
|
582
|
-
replaces it atomically
|
|
583
|
-
|
|
587
|
+
replaces it atomically, through `sync._update`, which reads the file again
|
|
588
|
+
under `git-worktrees-sync.lock` and builds the new one from that read: a
|
|
589
|
+
read taken before the fetch would write back a proof another worktree's
|
|
590
|
+
sync dropped meanwhile. The lock covers the read and the write and never a
|
|
591
|
+
network call; its holder's pid is in the file, the spinner names it while
|
|
592
|
+
another process waits, and a wait past `_LOCK_WAIT` leaves the cache
|
|
593
|
+
unsaved. Remote identity changes invalidate it; malformed or mismatched
|
|
594
|
+
evidence is never proof. `branch_forge.request_for` reads it once per
|
|
595
|
+
assessment, under a lock, since its rows start together on eight threads.
|
|
584
596
|
|
|
585
597
|
`sync._FRESH` is 10 minutes. Warnings compare the oldest non-null component
|
|
586
|
-
time, with exactly 10 minutes still fresh.
|
|
598
|
+
time, with exactly 10 minutes still fresh. A time after now is a clock that
|
|
599
|
+
moved back: `sync.due` says due and `sync.freshness` warns. The never-synced line goes to
|
|
587
600
|
stderr under `-q` and `--json` as well, because a caller acting on the
|
|
588
601
|
verdicts needs to hear that no sync stands behind them. Quiet and JSON
|
|
589
602
|
suppress every other warning, the inferred-head notice included; a removal's
|
|
@@ -611,7 +624,9 @@ a ref an earlier removal moved refuses the later one, and
|
|
|
611
624
|
`git worktree remove` refuses a checkout dirtied since. What the wider gap
|
|
612
625
|
leaves open is an ignored path written between the batch recheck and that
|
|
613
626
|
target's removal. A single target, as `gw remove` has, is rechecked as it
|
|
614
|
-
is removed
|
|
627
|
+
is removed, and its record is compared both before that assessment and
|
|
628
|
+
after it: the assessment takes seconds, and a commit made on a detached
|
|
629
|
+
HEAD meanwhile leaves the tree clean and is reachable from nothing else.
|
|
615
630
|
|
|
616
631
|
An assessment asks every worktree the same questions about the head, so
|
|
617
632
|
`merged.reuse()` keeps the answers that name objects by full SHA for the
|
|
@@ -627,7 +642,10 @@ atomically when the assessment ends. They have no TTL, since neither commit
|
|
|
627
642
|
changes; the file holds one head's answers and starts again when the head
|
|
628
643
|
moves, which bounds it. A partial clone saves only a yes, because a fetch
|
|
629
644
|
can bring the object a no lacked without moving the head, and an entry that
|
|
630
|
-
is not the shape `merged.py` wrote is asked again.
|
|
645
|
+
is not the shape `merged.py` wrote is asked again. The file carries
|
|
646
|
+
`merged._RULES`, and a file under any other value is read as empty, so a
|
|
647
|
+
change to how a proof is reached invalidates every answer the old rule
|
|
648
|
+
gave. Nothing a checkout holds
|
|
631
649
|
is saved: `git status`, submodules, an operation in progress, reflogs and
|
|
632
650
|
stashes are read on every run, since they are what stops a worktree with
|
|
633
651
|
work in it being offered.
|
|
@@ -780,12 +798,15 @@ both ways was 18 of an assessment's 35 calls over nine worktrees.
|
|
|
780
798
|
`guard()` runs on the resolved argv inside the wrapper, not at declaration, so
|
|
781
799
|
no call site can assemble its way past it. `reset --hard`, a forced `checkout`
|
|
782
800
|
or `switch`, `clean -f`, a bare `push --force`, `worktree remove --force`,
|
|
783
|
-
`branch -D
|
|
784
|
-
|
|
801
|
+
`branch -D`, an `update-ref` delete that names no full sha and a forced
|
|
802
|
+
fetch into a local ref are refused absolutely. The push rule counts a `+`
|
|
803
|
+
refspec as `--force`, the branch rule counts `-d` with `-f` in any spelling,
|
|
804
|
+
and the fetch rule reads only refspecs on the command line, since sync
|
|
805
|
+
checks the configured ones before it fetches. There is no flag, and `--yes` least of all. `gw remove` prints
|
|
785
806
|
`git worktree remove --force PATH` beside a dirty target's refusal, for a
|
|
786
807
|
person who has looked to run; nothing here runs it.
|
|
787
808
|
|
|
788
|
-
Those
|
|
809
|
+
Those eight are `RULES`, a tuple, each row carrying the name `--explain`
|
|
789
810
|
prints, the clause the refusal ends with, and the test. The footer `--explain`
|
|
790
811
|
prints is built from it. A rule written in one place and described in another
|
|
791
812
|
is a rule that goes quiet: the hand-written footer fell a rule behind the
|
|
@@ -816,6 +837,13 @@ reflog. `merged.reflog_only` lists the commits only those reach, by
|
|
|
816
837
|
they hold the row back until `--delete reflog`, which `--delete all`
|
|
817
838
|
includes and which is the one value `--keep-branch` takes.
|
|
818
839
|
|
|
840
|
+
Patch-ids come from `git patch-id --verbatim`, Git 2.39 onward, which
|
|
841
|
+
counts whitespace: a change that differs from a head commit only in
|
|
842
|
+
indentation is a different program in Python or YAML, so it is neither a
|
|
843
|
+
squash proof nor a reflog commit the head already has. `fast_forward` and
|
|
844
|
+
`push` read the same ids. On older Git the call exits 129, which the
|
|
845
|
+
assessment reports and which deletes nothing.
|
|
846
|
+
|
|
819
847
|
Content proof compares changed paths, modes and deletions against the head.
|
|
820
848
|
It cannot settle a stacked branch whose intermediate content the head later
|
|
821
849
|
edited. Cached forge proof verifies source tip, source repository, target
|
|
@@ -17,6 +17,48 @@ not in here, whatever it cost to build.
|
|
|
17
17
|
A release closes with a `### Choices` section when a decision in it is worth
|
|
18
18
|
the reader's time: what was chosen, and what the alternative failed to do.
|
|
19
19
|
|
|
20
|
+
## 0.13.4 - 2026-11-22
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
A branch whose only change after its squash merge was whitespace, such as
|
|
25
|
+
re-indenting a Python block, is no longer proved merged, so `gw prune` and
|
|
26
|
+
`gw branch prune` keep it. The same holds for a commit only a reflog still
|
|
27
|
+
reaches. Squash proof needs Git 2.39 or newer; on older Git an assessment
|
|
28
|
+
that needs one exits 1 and deletes nothing. Proofs saved by earlier
|
|
29
|
+
releases are checked again on the first run.
|
|
30
|
+
|
|
31
|
+
`gw remove` keeps a detached worktree in which a commit was made while its
|
|
32
|
+
recheck ran, and refuses with `worktree changed after assessment`.
|
|
33
|
+
|
|
34
|
+
`gw push` refuses to replace another clone's commit that reached the
|
|
35
|
+
branch through `git rebase origin/BRANCH` or a conflicted merge and was
|
|
36
|
+
then dropped locally. Before, the push went ahead without `--replace`.
|
|
37
|
+
|
|
38
|
+
`gw fast-forward --autostash` pushes a stacked branch whose request it
|
|
39
|
+
retargeted when only the uncommitted changes failed to re-apply. The
|
|
40
|
+
result is still `stash-conflict` at exit 1, with `pushed` or `unpushed`
|
|
41
|
+
set.
|
|
42
|
+
|
|
43
|
+
The guard refuses three more ways to lose work, whichever command would
|
|
44
|
+
issue them: a `git push` with a `+` refspec, `git branch -d` combined with
|
|
45
|
+
`-f` or `--force` in any spelling, and a `git fetch` whose refspec forces
|
|
46
|
+
a local branch or tag. `gw --explain` lists the new rule.
|
|
47
|
+
|
|
48
|
+
Two worktrees syncing at once no longer undo each other: a sync re-reads
|
|
49
|
+
the shared cache under a lock just before it writes. While another process
|
|
50
|
+
holds the lock, the spinner reads `waiting for the sync cache lock, held by
|
|
51
|
+
pid N`; after 30 seconds the sync reports `cannot save sync evidence` and
|
|
52
|
+
leaves the cache as it was.
|
|
53
|
+
|
|
54
|
+
A last sync dated after the machine's clock counts as stale, so the next
|
|
55
|
+
command syncs first and warns `Last sync is dated after this machine's
|
|
56
|
+
clock`.
|
|
57
|
+
|
|
58
|
+
The spinner and the `gw list` picker no longer leave stale lines on the
|
|
59
|
+
screen when a branch or path holds wide characters, such as a branch
|
|
60
|
+
named in Chinese or Japanese: each row is cut by the columns it takes.
|
|
61
|
+
|
|
20
62
|
## 0.13.3 - 2026-11-22
|
|
21
63
|
|
|
22
64
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: git-worktrees
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.4
|
|
4
4
|
Summary: Git worktree commands that refuse to lose work.
|
|
5
5
|
Project-URL: Bug reports, https://github.com/MihaiBojin/worktrees/issues/new
|
|
6
6
|
Project-URL: Source, https://github.com/MihaiBojin/worktrees
|
|
@@ -108,7 +108,7 @@ the plugin's tag to the same release, as each manager below describes.
|
|
|
108
108
|
### fish
|
|
109
109
|
|
|
110
110
|
```console
|
|
111
|
-
fisher install MihaiBojin/worktrees@v0.13.
|
|
111
|
+
fisher install MihaiBojin/worktrees@v0.13.4
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
Fisher copies `functions/`, `completions/` and `conf.d/` from the repository
|
|
@@ -125,7 +125,7 @@ the untagged one holds the files.
|
|
|
125
125
|
Antidote takes a `path:` into the repository, and `branch:` takes a tag:
|
|
126
126
|
|
|
127
127
|
```
|
|
128
|
-
MihaiBojin/worktrees branch:v0.13.
|
|
128
|
+
MihaiBojin/worktrees branch:v0.13.4 path:zsh/plugins/worktrees # in zsh_plugins.txt
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
The plugin puts its own `functions/` and `completions/` on `fpath` and
|
|
@@ -200,8 +200,8 @@ its stdout stays the version alone for a script to read.
|
|
|
200
200
|
An excerpt of `gw --help`'s release lines with matching CLI and shell releases:
|
|
201
201
|
|
|
202
202
|
```console
|
|
203
|
-
worktrees 0.13.
|
|
204
|
-
The shell plugin here is 0.13.
|
|
203
|
+
worktrees 0.13.4: git worktree commands that refuse to lose work
|
|
204
|
+
The shell plugin here is 0.13.4, the same release as these commands.
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
A shell without the variable has no plugin loaded, or one older than the
|
|
@@ -492,6 +492,11 @@ every run and refuses when that fails.
|
|
|
492
492
|
command off the network: nothing syncs first, and `gw sync` and `gw push`
|
|
493
493
|
refuse at exit 3.
|
|
494
494
|
|
|
495
|
+
Squash proof needs Git 2.39 or newer, for `git patch-id --verbatim`, which
|
|
496
|
+
counts whitespace: a branch that changed only indentation after its squash
|
|
497
|
+
merge is not proved merged. On older Git, an assessment that needs a squash
|
|
498
|
+
proof exits 1 and deletes nothing.
|
|
499
|
+
|
|
495
500
|
Commands that read objects in a partial clone need Git 2.45.1 or newer, or a
|
|
496
501
|
patched maintenance release:
|
|
497
502
|
2.39.4, 2.40.2, 2.41.1, 2.42.2, 2.43.4 or 2.44.1 and later patches in those
|
|
@@ -708,8 +713,17 @@ push --force
|
|
|
708
713
|
worktree remove --force
|
|
709
714
|
branch -D
|
|
710
715
|
an update-ref delete that names no full sha
|
|
716
|
+
a forced fetch into a local ref
|
|
711
717
|
```
|
|
712
718
|
|
|
719
|
+
`push --force` covers `-f` and a `+` refspec such as `+main:main`, lease or
|
|
720
|
+
none. `branch -D` covers `-d` with `-f` or `--force` in any order or bundle,
|
|
721
|
+
such as `-df`. A forced fetch is a command-line refspec that `+`, `--force`
|
|
722
|
+
or `-f` forces into anything outside `refs/remotes/`, a local branch or a
|
|
723
|
+
tag; sync refuses a configured refspec that writes there before it fetches.
|
|
724
|
+
`git branch -f`, `-M` and `-C`, which move or overwrite a branch, and
|
|
725
|
+
`git push --delete` are outside the list: no command here issues them.
|
|
726
|
+
|
|
713
727
|
## Agent plugin
|
|
714
728
|
|
|
715
729
|
[The agent plugin](plugin/README.md) gives Claude Code and Codex six skills
|
|
@@ -81,7 +81,7 @@ the plugin's tag to the same release, as each manager below describes.
|
|
|
81
81
|
### fish
|
|
82
82
|
|
|
83
83
|
```console
|
|
84
|
-
fisher install MihaiBojin/worktrees@v0.13.
|
|
84
|
+
fisher install MihaiBojin/worktrees@v0.13.4
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
Fisher copies `functions/`, `completions/` and `conf.d/` from the repository
|
|
@@ -98,7 +98,7 @@ the untagged one holds the files.
|
|
|
98
98
|
Antidote takes a `path:` into the repository, and `branch:` takes a tag:
|
|
99
99
|
|
|
100
100
|
```
|
|
101
|
-
MihaiBojin/worktrees branch:v0.13.
|
|
101
|
+
MihaiBojin/worktrees branch:v0.13.4 path:zsh/plugins/worktrees # in zsh_plugins.txt
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
The plugin puts its own `functions/` and `completions/` on `fpath` and
|
|
@@ -173,8 +173,8 @@ its stdout stays the version alone for a script to read.
|
|
|
173
173
|
An excerpt of `gw --help`'s release lines with matching CLI and shell releases:
|
|
174
174
|
|
|
175
175
|
```console
|
|
176
|
-
worktrees 0.13.
|
|
177
|
-
The shell plugin here is 0.13.
|
|
176
|
+
worktrees 0.13.4: git worktree commands that refuse to lose work
|
|
177
|
+
The shell plugin here is 0.13.4, the same release as these commands.
|
|
178
178
|
```
|
|
179
179
|
|
|
180
180
|
A shell without the variable has no plugin loaded, or one older than the
|
|
@@ -465,6 +465,11 @@ every run and refuses when that fails.
|
|
|
465
465
|
command off the network: nothing syncs first, and `gw sync` and `gw push`
|
|
466
466
|
refuse at exit 3.
|
|
467
467
|
|
|
468
|
+
Squash proof needs Git 2.39 or newer, for `git patch-id --verbatim`, which
|
|
469
|
+
counts whitespace: a branch that changed only indentation after its squash
|
|
470
|
+
merge is not proved merged. On older Git, an assessment that needs a squash
|
|
471
|
+
proof exits 1 and deletes nothing.
|
|
472
|
+
|
|
468
473
|
Commands that read objects in a partial clone need Git 2.45.1 or newer, or a
|
|
469
474
|
patched maintenance release:
|
|
470
475
|
2.39.4, 2.40.2, 2.41.1, 2.42.2, 2.43.4 or 2.44.1 and later patches in those
|
|
@@ -681,8 +686,17 @@ push --force
|
|
|
681
686
|
worktree remove --force
|
|
682
687
|
branch -D
|
|
683
688
|
an update-ref delete that names no full sha
|
|
689
|
+
a forced fetch into a local ref
|
|
684
690
|
```
|
|
685
691
|
|
|
692
|
+
`push --force` covers `-f` and a `+` refspec such as `+main:main`, lease or
|
|
693
|
+
none. `branch -D` covers `-d` with `-f` or `--force` in any order or bundle,
|
|
694
|
+
such as `-df`. A forced fetch is a command-line refspec that `+`, `--force`
|
|
695
|
+
or `-f` forces into anything outside `refs/remotes/`, a local branch or a
|
|
696
|
+
tag; sync refuses a configured refspec that writes there before it fetches.
|
|
697
|
+
`git branch -f`, `-M` and `-C`, which move or overwrite a branch, and
|
|
698
|
+
`git push --delete` are outside the list: no command here issues them.
|
|
699
|
+
|
|
686
700
|
## Agent plugin
|
|
687
701
|
|
|
688
702
|
[The agent plugin](plugin/README.md) gives Claude Code and Codex six skills
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
# The release this plugin came from, which `gw --help` and `gw version` compare
|
|
5
5
|
# with their own. Exported, because the environment is all a binary can see
|
|
6
6
|
# of the shell that started it.
|
|
7
|
-
set -gx WORKTREES_PLUGIN_VERSION 0.13.
|
|
7
|
+
set -gx WORKTREES_PLUGIN_VERSION 0.13.4
|
|
@@ -128,8 +128,9 @@ prints every spec, marking the ones that mutate.
|
|
|
128
128
|
|
|
129
129
|
A guard runs on the resolved argv inside the wrapper, so no call site can
|
|
130
130
|
assemble its way past it: `reset --hard`, a forced `checkout` or `switch`,
|
|
131
|
-
`clean -f`, a
|
|
132
|
-
|
|
131
|
+
`clean -f`, a forced push, `--force`, `-f` or a `+` refspec, `worktree
|
|
132
|
+
remove --force`, `branch -D` in any spelling, ref deletion without a full
|
|
133
|
+
expected SHA and a forced fetch into a local ref are refused.
|
|
133
134
|
|
|
134
135
|
## Commands that land you somewhere need a shell function
|
|
135
136
|
|
|
@@ -88,6 +88,18 @@ own patch-id the head lacks since its merge base. Under `--keep-branch` only
|
|
|
88
88
|
the worktree's reflog goes. Those commits hold the row back with a
|
|
89
89
|
protection naming `git show SHA` for each, and `--delete reflog` lifts it.
|
|
90
90
|
|
|
91
|
+
Squash proof and the reflog check compare patch-ids from
|
|
92
|
+
`git patch-id --verbatim`, which counts whitespace, and Git 2.39 or newer
|
|
93
|
+
provides it. A branch whose combined change differs from a head commit only
|
|
94
|
+
in indentation, or in trailing or inner spaces, has no squash proof: in
|
|
95
|
+
Python, YAML or a Makefile the two are different programs. The same holds
|
|
96
|
+
for a reflog-only commit, which then needs `--delete reflog`. Older Git
|
|
97
|
+
exits 129 on `--verbatim`. An assessment that needs a patch-id then exits 1
|
|
98
|
+
with Git's `unknown option` message and deletes nothing: `gw prune` and
|
|
99
|
+
`gw remove` print no verdicts, and `gw branch status` and `gw branch prune`
|
|
100
|
+
show the row as `keep` with that error. A branch that ancestry, an equal
|
|
101
|
+
tree or content proof settles needs no patch-id and is assessed as usual.
|
|
102
|
+
|
|
91
103
|
The first-parent set is computed once per assessment. A divergent local
|
|
92
104
|
counterpart does not extend it. Local content proof compares every changed
|
|
93
105
|
path from merge base to branch tip with the head tree, including modes and
|
|
@@ -166,7 +178,16 @@ anyway?`, unless `--yes` skips confirmation.
|
|
|
166
178
|
After confirmation, the command assesses again and refuses changed targets,
|
|
167
179
|
head identity, cleanliness, lock state, ignored paths or matching stashes.
|
|
168
180
|
Git can collapse an ignored directory into one status entry; this comparison
|
|
169
|
-
does not fingerprint contents below that entry.
|
|
181
|
+
does not fingerprint contents below that entry. The worktree's record, its
|
|
182
|
+
branch, HEAD sha and lock flags, is compared with the assessed one both
|
|
183
|
+
before that assessment and after it, just before `git worktree remove`. A
|
|
184
|
+
commit made in the worktree while the recheck runs leaves the tree clean, so
|
|
185
|
+
the record is the only thing that shows it; on a detached HEAD that commit is
|
|
186
|
+
reachable from nothing else. Such a target is refused as `worktree changed
|
|
187
|
+
after assessment`, and its checkout stays. `gw prune` rechecks its whole
|
|
188
|
+
batch first and then removes one target at a time, so an ignored path
|
|
189
|
+
written in another target between that recheck and its removal goes with
|
|
190
|
+
it.
|
|
170
191
|
|
|
171
192
|
Removal uses `git worktree remove` without force. Only after that succeeds,
|
|
172
193
|
`git update-ref --no-deref -d REF FULL_SHA` deletes the attached branch at
|
|
@@ -204,7 +225,9 @@ assessment saves the proofs it found in `git-worktrees-proofs.json` in the
|
|
|
204
225
|
Git common directory, so the next one does not ask git for them again. Each
|
|
205
226
|
is a fact about a branch's commit and the head's, both named by full SHA, so
|
|
206
227
|
it has no age: the file holds one head commit's proofs and starts again when
|
|
207
|
-
the head moves.
|
|
228
|
+
the head moves. The file names the proof rules it was written under as
|
|
229
|
+
`"rules": 2`, and a file with another value or none is read as empty, so a
|
|
230
|
+
proof found under an older rule is asked again. A partial clone saves only a yes, since a fetch can bring the
|
|
208
231
|
object a no was missing. What a checkout holds, `git status` and the rest, is
|
|
209
232
|
read on every run and never saved. The sync
|
|
210
233
|
that runs before them when one is due writes remote-tracking refs, the
|
|
@@ -453,6 +476,20 @@ and replaced atomically. Remote name and URL identify it. A mismatch makes
|
|
|
453
476
|
the cache unusable and the repository never synced. Forge entries are keyed
|
|
454
477
|
by branch and source SHA; moved or new branches need sync for forge proof.
|
|
455
478
|
|
|
479
|
+
Two worktrees can sync at once. Each sync reads the cache again just before
|
|
480
|
+
it writes, holding `git-worktrees-sync.lock` in the Git common directory
|
|
481
|
+
only for that read and the write, never across a fetch or a forge query. So
|
|
482
|
+
a sync that finishes second keeps what the first one wrote: a branch whose
|
|
483
|
+
forge query failed in one stays without proof, whatever the other read
|
|
484
|
+
before its fetch. The holder writes its pid into the lock file. While
|
|
485
|
+
another process holds it, the spinner reads `waiting for the sync cache
|
|
486
|
+
lock, held by pid N`; after 30 seconds the sync gives up with
|
|
487
|
+
`cannot save sync evidence: the sync cache is locked by pid N`, the cache
|
|
488
|
+
stays as it was, and the next command that is due syncs again. On a
|
|
489
|
+
filesystem without `flock` the cache is written unlocked. One assessment
|
|
490
|
+
reads the cache once, for every row, so a sync in another worktree during
|
|
491
|
+
it cannot judge some rows on old evidence and others on new.
|
|
492
|
+
|
|
456
493
|
| Sync result | Refs time | Forge time | Status | Forge evidence |
|
|
457
494
|
| --- | --- | --- | --- | --- |
|
|
458
495
|
| Fetch and queries succeed | advances | advances | 0 | matching requests |
|
|
@@ -472,7 +509,9 @@ A remote repository with no refs sync time prints a never-synced warning on
|
|
|
472
509
|
stderr, under `-q` and `--json` too, so a caller acting on the verdicts hears
|
|
473
510
|
that no sync stands behind them. The older non-null sync time is stale after
|
|
474
511
|
10 minutes, with exactly 10 minutes still fresh. Human output prints age and
|
|
475
|
-
suggests `gw sync`.
|
|
512
|
+
suggests `gw sync`. A sync time later than the machine's clock, after the
|
|
513
|
+
clock moved back, is stale too: the warning reads `Last sync is dated after
|
|
514
|
+
this machine's clock`, and the next command syncs first. Quiet and JSON output suppress the stale warning and the
|
|
476
515
|
inferred head notice; a removal's disclosure still repeats them. Repositories
|
|
477
516
|
without remotes, the local case, have neither warning. `gw sync` and `gw version`
|
|
478
517
|
print the head line, and a head that does not resolve is named in it. JSON provides the state instead. The 10 minutes
|
|
@@ -141,7 +141,10 @@ differs, the run pushes it with `git push --force-with-lease
|
|
|
141
141
|
drops a parent's merged commits from a branch with an open request, since
|
|
142
142
|
the request reads the remote copy. git refuses when the copy holds commits
|
|
143
143
|
this clone never had; the branch stays level here, `unpushed` says why, and
|
|
144
|
-
the exit status is still 0. A
|
|
144
|
+
the exit status is still 0. A `stash-conflict` is pushed the same way: the
|
|
145
|
+
commits moved and only the uncommitted changes failed to re-apply, so the
|
|
146
|
+
run exits 1 for the stash with `pushed` or `unpushed` set as for a level
|
|
147
|
+
branch. A rebase that stopped pushes nothing: push it
|
|
145
148
|
with [`gw push`](push.md) once it is finished. Offline, nothing is moved and
|
|
146
149
|
nothing is pushed.
|
|
147
150
|
|
|
@@ -63,6 +63,11 @@ With stdin a terminal and neither `--json` nor `--table`:
|
|
|
63
63
|
- A query whose only match is the worktree you stand in prints
|
|
64
64
|
`already in NAME` and exits 0.
|
|
65
65
|
|
|
66
|
+
Where the picker redraws in place, each row is cut to the terminal's width
|
|
67
|
+
by the columns it takes, a wide character such as one in a CJK branch name
|
|
68
|
+
taking two, so no row wraps. Its columns are padded by character count, so
|
|
69
|
+
a row holding wide characters sits up to their number of columns off.
|
|
70
|
+
|
|
66
71
|
The picker prints each remote's name and URL above the rows, so you can see
|
|
67
72
|
which repository it is. Typing filters the rows with the matching above,
|
|
68
73
|
digits included, since branch names carry them. Backspace takes a character
|
|
@@ -50,6 +50,16 @@ during a rebase, changes a commit's patch-id; when the commit was made here,
|
|
|
50
50
|
the rewrite is this clone's own and the push goes ahead. A commit that came
|
|
51
51
|
by a pull or a merge was made elsewhere.
|
|
52
52
|
|
|
53
|
+
What an entry built on was made elsewhere too. A rebase entry,
|
|
54
|
+
`rebase (finish): refs/heads/BRANCH onto SHA`, brings only the commits
|
|
55
|
+
after `SHA`: `git rebase origin/BRANCH` puts another clone's commits under
|
|
56
|
+
the branch's own, and they stay that clone's. A `commit (merge)` entry, a
|
|
57
|
+
merge whose conflicts were resolved and committed here, brings the merge
|
|
58
|
+
commit alone, not what its other parents reach. So a branch that took
|
|
59
|
+
another clone's commit by either route and then dropped it, with
|
|
60
|
+
`git reset --hard`, `git rebase --onto` or an interactive rebase, is
|
|
61
|
+
refused, and `--replace` pushes over it once that commit is checked.
|
|
62
|
+
|
|
53
63
|
`--replace` lifts this check, for a person who has read each commit listed:
|
|
54
64
|
a commit another clone made, pulled here and then edited, reads as one the
|
|
55
65
|
branch lacks.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "worktrees",
|
|
4
|
-
"version": "0.13.
|
|
4
|
+
"version": "0.13.4",
|
|
5
5
|
"description": "Read CI, rebase onto the head branch, describe, ship and merge pull requests, and prune finished worktrees through the worktrees CLI",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Mihai Bojin",
|
|
@@ -52,7 +52,8 @@ Read stdout, stderr and the exit status.
|
|
|
52
52
|
the entry that still holds the changes as they were. Report both, with
|
|
53
53
|
`git stash apply STASH` as the way back. The changes are the user's own
|
|
54
54
|
work: resolve the markers only when the user asks, and never drop the
|
|
55
|
-
entry.
|
|
55
|
+
entry. The commits are level, so report `pushed` or `unpushed` as for
|
|
56
|
+
exit 0.
|
|
56
57
|
- Any other non-zero exit leaves stdout empty. That is a refusal, and the
|
|
57
58
|
branch is unchanged. Report stderr as the CLI wrote it and stop. Do not
|
|
58
59
|
work around it with `git rebase`, `git merge`, `git switch` or `git stash`.
|
|
@@ -9,7 +9,7 @@ authors = [
|
|
|
9
9
|
]
|
|
10
10
|
# Static, and the single source of truth for the version. Bump it in a pull
|
|
11
11
|
# request and run `uv lock`; the release tag only has to agree with it.
|
|
12
|
-
version = "0.13.
|
|
12
|
+
version = "0.13.4"
|
|
13
13
|
# The standard library answers every question this asks. A dependency here
|
|
14
14
|
# would be paid on every invocation, and an invocation is 67 ms of which 25 ms
|
|
15
15
|
# is the interpreter starting.
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import os
|
|
6
6
|
import re
|
|
7
7
|
import shutil
|
|
8
|
+
import threading
|
|
8
9
|
from dataclasses import asdict, dataclass
|
|
9
10
|
from urllib.parse import quote, urlsplit
|
|
10
11
|
|
|
@@ -96,6 +97,9 @@ def provider(
|
|
|
96
97
|
return None
|
|
97
98
|
|
|
98
99
|
|
|
100
|
+
_sync_read = threading.Lock()
|
|
101
|
+
|
|
102
|
+
|
|
99
103
|
def available(tool: str) -> bool:
|
|
100
104
|
return bool(shutil.which(tool))
|
|
101
105
|
|
|
@@ -104,11 +108,18 @@ def request_for(
|
|
|
104
108
|
branch: str, remote: str, sha: str = "", repo: str | os.PathLike[str] | None = None
|
|
105
109
|
) -> Request | None:
|
|
106
110
|
"""Read source-tip evidence from the shared sync cache, without a query."""
|
|
107
|
-
from . import sync
|
|
111
|
+
from . import merged, sync
|
|
108
112
|
|
|
109
113
|
if not sha:
|
|
110
114
|
sha = R.local_sha(f"refs/heads/{branch}", repo=repo).out.strip()
|
|
111
|
-
|
|
115
|
+
# Once an assessment, not once a row: every row then reads one
|
|
116
|
+
# snapshot, though another worktree's sync replaces the file meanwhile.
|
|
117
|
+
# Keyed by the file, which every worktree's row shares, and under a lock,
|
|
118
|
+
# since the rows start together and would all miss the first read.
|
|
119
|
+
with _sync_read:
|
|
120
|
+
cache = merged._recall(("sync", str(sync.path(repo))), lambda: sync.read(repo))
|
|
121
|
+
assert isinstance(cache, dict)
|
|
122
|
+
entry = cache["branches"].get(branch)
|
|
112
123
|
if not isinstance(entry, dict) or entry.get("sha") != sha:
|
|
113
124
|
return None
|
|
114
125
|
data = entry.get("request")
|
|
@@ -382,9 +382,11 @@ def _level(
|
|
|
382
382
|
moved.retargeted = done.get("retargeted") or {}
|
|
383
383
|
moved.rescued = done.get("rescued") or {}
|
|
384
384
|
# A request open on the forge reads the branch's remote copy, and the
|
|
385
|
-
# copy still holds what the rebase dropped.
|
|
385
|
+
# copy still holds what the rebase dropped. A stash that did not
|
|
386
|
+
# re-apply leaves the commits level all the same.
|
|
386
387
|
if stack.request is not None and (
|
|
387
|
-
moved.retargeted
|
|
388
|
+
moved.retargeted
|
|
389
|
+
or (moved.result in (REBASED, STASH_CONFLICT) and moved.boundary)
|
|
388
390
|
):
|
|
389
391
|
return _publish(moved, remote, repo)
|
|
390
392
|
return moved
|
|
@@ -796,10 +798,12 @@ def _publish(moved: Moved, remote: str, repo: str | os.PathLike[str] | None) ->
|
|
|
796
798
|
"""Push the levelled branch over its remote copy, under a lease.
|
|
797
799
|
|
|
798
800
|
Only a branch that is level and has a copy that differs: a stopped
|
|
799
|
-
rebase is pushed by whoever finishes it
|
|
800
|
-
|
|
801
|
+
rebase is pushed by whoever finishes it, and a stash conflict is not a
|
|
802
|
+
stop, since the commits moved and only the uncommitted work did not
|
|
803
|
+
re-apply. git refuses when the copy holds commits this clone never had,
|
|
804
|
+
and the branch is then left unpushed.
|
|
801
805
|
"""
|
|
802
|
-
if moved.result not in (CURRENT, REBASED) or not remote:
|
|
806
|
+
if moved.result not in (CURRENT, REBASED, STASH_CONFLICT) or not remote:
|
|
803
807
|
return moved
|
|
804
808
|
local = f"refs/heads/{moved.branch}"
|
|
805
809
|
copy = R.local_sha(f"refs/remotes/{remote}/{moved.branch}", repo=repo).value
|
|
@@ -147,6 +147,29 @@ def _full_sha(value: str) -> bool:
|
|
|
147
147
|
return len(value) in (40, 64) and all(c in "0123456789abcdef" for c in value)
|
|
148
148
|
|
|
149
149
|
|
|
150
|
+
def _forced_local_fetch(rest: Sequence[str]) -> bool:
|
|
151
|
+
"""A refspec on the command line that overwrites a ref of this clone's own.
|
|
152
|
+
|
|
153
|
+
`+SRC:DST`, or any `SRC:DST` under `--force`, moves DST whatever it
|
|
154
|
+
held, and a local branch or tag there loses the commits only it reached.
|
|
155
|
+
A remote-tracking ref mirrors the remote and holds nothing of this
|
|
156
|
+
clone's. Configured refspecs are not in argv; sync checks those before
|
|
157
|
+
it fetches. The first argument that is not an option is the remote.
|
|
158
|
+
"""
|
|
159
|
+
forced = _short(rest, "f") or _has(rest, "--force")
|
|
160
|
+
places = [a for a in rest if not a.startswith("-")][1:]
|
|
161
|
+
for i, spec in enumerate(places):
|
|
162
|
+
if spec == "tag" and i + 1 < len(places):
|
|
163
|
+
target, plus = f"refs/tags/{places[i + 1]}", False
|
|
164
|
+
elif ":" in spec:
|
|
165
|
+
target, plus = spec.partition(":")[2], spec.startswith("+")
|
|
166
|
+
else:
|
|
167
|
+
continue
|
|
168
|
+
if (forced or plus) and target and not target.startswith("refs/remotes/"):
|
|
169
|
+
return True
|
|
170
|
+
return False
|
|
171
|
+
|
|
172
|
+
|
|
150
173
|
class Rule:
|
|
151
174
|
"""One command refused absolutely, under the name `--explain` prints.
|
|
152
175
|
|
|
@@ -207,9 +230,15 @@ RULES: tuple[Rule, ...] = (
|
|
|
207
230
|
"push --force",
|
|
208
231
|
"use --force-with-lease instead",
|
|
209
232
|
lambda head, rest: (
|
|
210
|
-
head == "push"
|
|
233
|
+
head == "push"
|
|
234
|
+
and (
|
|
235
|
+
_short(rest, "f")
|
|
236
|
+
or _has(rest, "--force")
|
|
237
|
+
# `+SRC:DST` forces that one ref, lease or none.
|
|
238
|
+
or any(a.startswith("+") for a in rest)
|
|
239
|
+
)
|
|
211
240
|
),
|
|
212
|
-
phrase="a bare `git push --force
|
|
241
|
+
phrase="a bare `git push --force`, or a `+` refspec",
|
|
213
242
|
),
|
|
214
243
|
Rule(
|
|
215
244
|
"worktree remove --force",
|
|
@@ -225,9 +254,20 @@ RULES: tuple[Rule, ...] = (
|
|
|
225
254
|
"a branch is deleted on proof of merge or not at all",
|
|
226
255
|
lambda head, rest: (
|
|
227
256
|
head == "branch"
|
|
228
|
-
and (
|
|
257
|
+
and (
|
|
258
|
+
_short(rest, "D")
|
|
259
|
+
or (
|
|
260
|
+
(_short(rest, "d") or _has(rest, "--delete"))
|
|
261
|
+
and (_short(rest, "f") or _has(rest, "--force"))
|
|
262
|
+
)
|
|
263
|
+
)
|
|
229
264
|
),
|
|
230
265
|
),
|
|
266
|
+
Rule(
|
|
267
|
+
"a forced fetch into a local ref",
|
|
268
|
+
"only remote-tracking refs may be overwritten by the remote",
|
|
269
|
+
lambda head, rest: head == "fetch" and _forced_local_fetch(rest),
|
|
270
|
+
),
|
|
231
271
|
# --stdin deletes refs with no -d anywhere in argv, so it is refused with
|
|
232
272
|
# the rest: the shape below is the only delete this program may issue.
|
|
233
273
|
Rule(
|