git-worktrees 0.11.0__tar.gz → 0.11.2__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.
Files changed (133) hide show
  1. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/AGENTS.md +44 -13
  2. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/CHANGELOG.md +32 -0
  3. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/PKG-INFO +6 -6
  4. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/README.md +5 -5
  5. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/conf.d/worktrees.fish +1 -1
  6. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/docs/REFERENCE.md +5 -4
  7. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/docs/commands/fast-forward.md +18 -10
  8. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/.claude-plugin/plugin.json +1 -1
  9. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/.codex-plugin/plugin.json +1 -1
  10. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/README.md +7 -1
  11. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/plugin.json +1 -1
  12. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/skills/fast-forward/SKILL.md +3 -2
  13. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/skills/preflight/rules.json +1 -0
  14. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/skills/ship-it/SKILL.md +28 -4
  15. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/skills/ship-it/rights.md +5 -0
  16. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/pyproject.toml +1 -1
  17. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/branch_cli.py +8 -2
  18. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/branches.py +1 -0
  19. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/cli.py +89 -29
  20. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/fast_forward.py +107 -8
  21. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/merged.py +89 -6
  22. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/repo.py +0 -30
  23. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/sync.py +10 -5
  24. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/verdicts.py +52 -15
  25. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_assessment.py +36 -0
  26. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_completions.py +42 -0
  27. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_fast_forward.py +134 -16
  28. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_gates.py +0 -42
  29. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_plugin.py +1 -0
  30. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_sync.py +3 -3
  31. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/uv.lock +2 -2
  32. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/worktrees.plugin.zsh +1 -1
  33. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/.claude/settings.json +0 -0
  34. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/.codex/config.toml +0 -0
  35. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/.github/workflows/codeql.yml +0 -0
  36. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/.github/workflows/publish.yml +0 -0
  37. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/.github/workflows/testpypi.yml +0 -0
  38. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/.github/workflows/tests.yml +0 -0
  39. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/.gitignore +0 -0
  40. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/.pre-commit-config.yaml +0 -0
  41. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/.python-version +0 -0
  42. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/.releasetools.yaml +0 -0
  43. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/LICENSE +0 -0
  44. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/Makefile +0 -0
  45. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/completions/gw.fish +0 -0
  46. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/completions/worktrees.fish +0 -0
  47. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/docs/BENCHMARK.md +0 -0
  48. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/docs/DEVELOPMENT.md +0 -0
  49. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/docs/commands/branch-prune.md +0 -0
  50. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/docs/commands/branch-status.md +0 -0
  51. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/docs/commands/ci-checks.md +0 -0
  52. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/docs/commands/merge.md +0 -0
  53. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/docs/plans/2026-11-05-worktree-pruning-design.md +0 -0
  54. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gw.fish +0 -0
  55. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwa.fish +0 -0
  56. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwbc.fish +0 -0
  57. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwbp.fish +0 -0
  58. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwbs.fish +0 -0
  59. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwff.fish +0 -0
  60. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwl.fish +0 -0
  61. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwm.fish +0 -0
  62. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwp!.fish +0 -0
  63. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwp.fish +0 -0
  64. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwpa!.fish +0 -0
  65. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwpa.fish +0 -0
  66. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwr!.fish +0 -0
  67. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gwr.fish +0 -0
  68. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/functions/gws.fish +0 -0
  69. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/hatch_build.py +0 -0
  70. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/hooks/codex.json +0 -0
  71. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/hooks/hooks.json +0 -0
  72. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/session.md +0 -0
  73. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/skills/ci-checks/SKILL.md +0 -0
  74. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/skills/describe-pr/SKILL.md +0 -0
  75. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/skills/describe-pr/format.md +0 -0
  76. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/skills/preflight/SKILL.md +0 -0
  77. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/skills/preflight/agents/openai.yaml +0 -0
  78. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/plugin/skills/prune/SKILL.md +0 -0
  79. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/renovate.json +0 -0
  80. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/scripts/README.md +0 -0
  81. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/scripts/benchmark.py +0 -0
  82. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/scripts/bump_version.py +0 -0
  83. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/scripts/verify-publish.bash +0 -0
  84. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/__init__.py +0 -0
  85. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/branch_forge.py +0 -0
  86. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/ci.py +0 -0
  87. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/errors.py +0 -0
  88. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/forge.py +0 -0
  89. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/git.py +0 -0
  90. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/layout.py +0 -0
  91. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/new_branch.py +0 -0
  92. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/pick.py +0 -0
  93. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/pr_merge.py +0 -0
  94. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/progress.py +0 -0
  95. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/prune.py +0 -0
  96. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/render.py +0 -0
  97. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/src/worktrees/worktree.py +0 -0
  98. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/conftest.py +0 -0
  99. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_benchmark.py +0 -0
  100. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_branch_forge.py +0 -0
  101. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_branches.py +0 -0
  102. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_ci.py +0 -0
  103. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_cli.py +0 -0
  104. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_command_defaults.py +0 -0
  105. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_fixture.py +0 -0
  106. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_forge.py +0 -0
  107. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_git_records.py +0 -0
  108. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_new_branch.py +0 -0
  109. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_partial_clone.py +0 -0
  110. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_path_boundaries.py +0 -0
  111. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_pr_merge.py +0 -0
  112. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_removal.py +0 -0
  113. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_render.py +0 -0
  114. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_shims.py +0 -0
  115. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_spec.py +0 -0
  116. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_version.py +0 -0
  117. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/tests/test_worktree.py +0 -0
  118. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/completions/_gw +0 -0
  119. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gw +0 -0
  120. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwa +0 -0
  121. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwbc +0 -0
  122. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwbp +0 -0
  123. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwbs +0 -0
  124. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwff +0 -0
  125. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwl +0 -0
  126. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwm +0 -0
  127. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwp +0 -0
  128. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwp! +0 -0
  129. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwpa +0 -0
  130. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwpa! +0 -0
  131. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwr +0 -0
  132. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gwr! +0 -0
  133. {git_worktrees-0.11.0 → git_worktrees-0.11.2}/zsh/plugins/worktrees/functions/gws +0 -0
@@ -127,11 +127,18 @@ ref or `--from`. Commits after the merged part are replayed onto it with
127
127
  a time an earlier rotation put in front, and a name held here or on the
128
128
  default remote is refused.
129
129
 
130
- It decides on evidence read in the same run. It fetches the default remote
131
- whatever the TTL and asks the forge for the branch's newest merged request,
132
- never reading the cached one, since a pull request merged a moment ago is
133
- the usual reason to run it. Either failing is a refusal whose last line is
134
- the same command under `WORKTREES_OFFLINE=1`.
130
+ It fetches the default remote when a sync is due and asks the forge for
131
+ the branch's newest merged request in every run, never reading the cached
132
+ one, since a pull request merged a moment ago is the usual reason to run it.
133
+ A merge commit the forge names that the head ref lacks raises `_Behind`
134
+ before anything moves, and `fast_forward` fetches and decides once more.
135
+ A failed fetch or forge query is a refusal whose last line is the same
136
+ command under `WORKTREES_OFFLINE=1`.
137
+
138
+ A branch whose open request targets another branch with an open request,
139
+ a stacked one, is levelled with that branch instead of the head ref:
140
+ `fast_forward.stacked_on` reads both requests from the forge in the same
141
+ run, and the branch below levels with the head ref in its own run.
135
142
 
136
143
  Every other branch keeps its name. One with no commits of its own
137
144
  fast-forwards and one with commits is rebased, both with `--no-autostash`
@@ -183,6 +190,14 @@ A completion asks the CLI for its candidates rather than deriving them, and
183
190
  by a tab, which fish reads directly and zsh splits for `_describe`. Hidden from
184
191
  `--help`, because a person has `gw --help` and `--table` for the same answers.
185
192
 
193
+ Every TAB runs one, so `main()` answers the exact words the completion files
194
+ send before it builds a parser: `gw list`, `gw remove`, `gw branch`,
195
+ `gw branch status` and `gw branch prune`, each followed by `--complete`.
196
+ Building the argparse tree costs more than the answer, and on Python 3.14 a
197
+ parser imports `_colorize` as it is made. Any other words reach the parser,
198
+ so a typo still gets its usage error. The output is the same either way, and
199
+ `tests/test_completions.py` drives it through both shells.
200
+
186
201
  No shell file holds a candidate or a rank. What `completions/gw.fish` and
187
202
  `_gw` do carry is each subcommand's flags, and `tests/test_completions.py`
188
203
  diffs those against `gw <command> --help` in both directions for both shells:
@@ -441,14 +456,14 @@ every local branch tip on eight threads. Every other command but
441
456
  `gw version`, `gw list`, `gw ci-checks`, `gw merge`, `gw fast-forward`, help and
442
457
  completion runs the same `sync.run` first when
443
458
  `sync.due` says so: the default remote's refs time is null or at least
444
- `WORKTREES_SYNC_TTL` seconds old, 60 by default. The forge time is not read,
459
+ `WORKTREES_SYNC_TTL` seconds old, 300 by default. The forge time is not read,
445
460
  since a forge that keeps failing would sync before every command. Without a
446
461
  default remote nothing syncs first, because sync records nothing there.
447
462
  `gw list` reads only the worktree records, so it never syncs first and
448
463
  prints no word about how fresh the evidence is; its `--json` takes `head`
449
- and `lastSync` from the cache. `gw fast-forward` runs `sync.fetch` on
450
- every run instead, which fetches the default remote and records the refs
451
- time.
464
+ and `lastSync` from the cache. `gw fast-forward` runs `sync.fetch`
465
+ instead when one is due, which fetches the default remote and records the
466
+ refs time.
452
467
 
453
468
  A failed sync before a command is a warning, and the command goes on with
454
469
  the evidence it has; quiet and JSON hide the warning. A failed fetch before
@@ -497,7 +512,22 @@ cohorts in `repo.require_offline_git`. Lower reported vendor versions refuse;
497
512
  full clones keep older Git compatibility. Offline proof uses read-only
498
513
  patch-id input and creates no synthetic commits.
499
514
 
500
- The per-worktree checks run on eight threads. Mutations remain serial.
515
+ The per-worktree checks run on a thread per core, eight at most. Each is a
516
+ git process whose work is the CPU's, so more threads than cores only queue
517
+ behind each other and the interpreter lock; `sync` keeps eight, since its
518
+ threads wait on the network. Mutations remain serial.
519
+
520
+ An assessment asks every worktree the same questions about the head, so
521
+ `merged.reuse()` keeps the answers that name objects by full SHA for the
522
+ length of one `assess`: a commit's tree, a merge base, the patch-ids of the
523
+ head's commits after a fork point. Those are facts about the objects. Nothing
524
+ outside an assessment keeps them, since `gw fast-forward` fetches and an
525
+ object missing a moment ago can appear, and a failed answer is never kept.
526
+
527
+ `git submodule status` is the costliest check, so the store decides alone
528
+ when it exists, and without one the check runs only where `.gitmodules`
529
+ exists. The store outlives a deleted `.gitmodules`, which is also when
530
+ `submodule status` itself fails with "no submodule mapping found".
501
531
 
502
532
  `gw ci-checks` takes GitHub's review and checks from one `gh pr view` with
503
533
  `statusCheckRollup` and `commits`. Commit messages and checks describe the
@@ -563,9 +593,10 @@ the subcommands they are; `is_ancestor` beats `merge_base`, because
563
593
  the caller wants.
564
594
 
565
595
  A spec with `ok=` wide enough to swallow an error is a spec that has to be
566
- tested on what it returns rather than on its exit code. `upstream_of` takes
567
- `ok=(0, 1, 128)`, so a typo in one of its flags exits 128, reads as "no
568
- upstream", and turns every branch into `unknown` with nothing failing.
596
+ tested on what it returns rather than on its exit code. `tree_of` takes
597
+ `ok=(0, 128)` for a ref that does not resolve, and a typo in its `^{tree}`
598
+ exits 128 too. The squash proof and the forge proof would then answer no for
599
+ every branch, and nothing would fail.
569
600
 
570
601
  The network calls belong to sync. Their results distinguish failed
571
602
  refs refresh from partial forge refresh; assessments retain usable local
@@ -17,6 +17,38 @@ 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.11.2 - 2026-11-15
21
+
22
+ ### Removed
23
+
24
+ `gw --explain` no longer lists `rev-parse --abbrev-ref
25
+ --symbolic-full-name $branch@{upstream}` or `for-each-ref
26
+ --format=%(upstream:track)`. No command ran either of them.
27
+
28
+ ## 0.11.1 - 2026-11-15
29
+
30
+ ### Added
31
+
32
+ `gw fast-forward` levels a branch stacked on another open pull request
33
+ with that branch, so a stack stays in order while its bottom is
34
+ reviewed. `/worktrees:ship-it` ships named branches that build on each
35
+ other as a stack: it opens each pull request on the one below with
36
+ `gh stack link --open`, which needs the `gh-stack` extension, and merges
37
+ bottom first. Add `Bash(gh stack link *)` to Claude Code's permissions,
38
+ or rerun `/worktrees:preflight`.
39
+
40
+ ### Changed
41
+
42
+ `WORKTREES_SYNC_TTL` defaults to 5 minutes, and `gw fast-forward` keeps
43
+ to it: it fetches once the last fetch is that old, or when the forge
44
+ reports a merge the fetched head branch does not hold yet.
45
+
46
+ ### Fixed
47
+
48
+ `gw prune` and `gw remove` keep a worktree whose submodule was initialized
49
+ before its `.gitmodules` was deleted, with reason `submodule`. They stopped
50
+ at exit 1 with "no submodule mapping found".
51
+
20
52
  ## 0.11.0 - 2026-11-14
21
53
 
22
54
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: git-worktrees
3
- Version: 0.11.0
3
+ Version: 0.11.2
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
@@ -104,7 +104,7 @@ the plugin's tag to the same release, as each manager below describes.
104
104
  ### fish
105
105
 
106
106
  ```console
107
- fisher install MihaiBojin/worktrees@v0.11.0
107
+ fisher install MihaiBojin/worktrees@v0.11.2
108
108
  ```
109
109
 
110
110
  Fisher copies `functions/`, `completions/` and `conf.d/` from the repository
@@ -121,7 +121,7 @@ the untagged one holds the files.
121
121
  Antidote takes a `path:` into the repository, and `branch:` takes a tag:
122
122
 
123
123
  ```
124
- MihaiBojin/worktrees branch:v0.11.0 path:zsh/plugins/worktrees # in zsh_plugins.txt
124
+ MihaiBojin/worktrees branch:v0.11.2 path:zsh/plugins/worktrees # in zsh_plugins.txt
125
125
  ```
126
126
 
127
127
  The plugin puts its own `functions/` and `completions/` on `fpath` and
@@ -196,8 +196,8 @@ its stdout stays the version alone for a script to read.
196
196
  An excerpt of `gw --help`'s release lines with matching CLI and shell releases:
197
197
 
198
198
  ```console
199
- worktrees 0.11.0: git worktree commands that refuse to lose work
200
- The shell plugin here is 0.11.0, the same release as these commands.
199
+ worktrees 0.11.2: git worktree commands that refuse to lose work
200
+ The shell plugin here is 0.11.2, the same release as these commands.
201
201
  ```
202
202
 
203
203
  A shell without the variable has no plugin loaded, or one older than the
@@ -425,7 +425,7 @@ A moved branch needs another sync for forge evidence; local proof still works.
425
425
 
426
426
  Every command except `gw sync`, `gw version`, `gw list`, `gw fast-forward`,
427
427
  help and completion syncs first when the default remote's refs have never
428
- synced or last synced 60 seconds ago or more. `WORKTREES_SYNC_TTL` sets that window in whole seconds, and `0`
428
+ synced or last synced 5 minutes ago or more. `WORKTREES_SYNC_TTL` sets that window in whole seconds, and `0`
429
429
  syncs before every command. The forge time does not count, so a forge that
430
430
  keeps failing does not make every command sync. A failed sync warns, `-q` and
431
431
  `--json` hide the warning, and the command goes on with the evidence it had.
@@ -77,7 +77,7 @@ the plugin's tag to the same release, as each manager below describes.
77
77
  ### fish
78
78
 
79
79
  ```console
80
- fisher install MihaiBojin/worktrees@v0.11.0
80
+ fisher install MihaiBojin/worktrees@v0.11.2
81
81
  ```
82
82
 
83
83
  Fisher copies `functions/`, `completions/` and `conf.d/` from the repository
@@ -94,7 +94,7 @@ the untagged one holds the files.
94
94
  Antidote takes a `path:` into the repository, and `branch:` takes a tag:
95
95
 
96
96
  ```
97
- MihaiBojin/worktrees branch:v0.11.0 path:zsh/plugins/worktrees # in zsh_plugins.txt
97
+ MihaiBojin/worktrees branch:v0.11.2 path:zsh/plugins/worktrees # in zsh_plugins.txt
98
98
  ```
99
99
 
100
100
  The plugin puts its own `functions/` and `completions/` on `fpath` and
@@ -169,8 +169,8 @@ its stdout stays the version alone for a script to read.
169
169
  An excerpt of `gw --help`'s release lines with matching CLI and shell releases:
170
170
 
171
171
  ```console
172
- worktrees 0.11.0: git worktree commands that refuse to lose work
173
- The shell plugin here is 0.11.0, the same release as these commands.
172
+ worktrees 0.11.2: git worktree commands that refuse to lose work
173
+ The shell plugin here is 0.11.2, the same release as these commands.
174
174
  ```
175
175
 
176
176
  A shell without the variable has no plugin loaded, or one older than the
@@ -398,7 +398,7 @@ A moved branch needs another sync for forge evidence; local proof still works.
398
398
 
399
399
  Every command except `gw sync`, `gw version`, `gw list`, `gw fast-forward`,
400
400
  help and completion syncs first when the default remote's refs have never
401
- synced or last synced 60 seconds ago or more. `WORKTREES_SYNC_TTL` sets that window in whole seconds, and `0`
401
+ synced or last synced 5 minutes ago or more. `WORKTREES_SYNC_TTL` sets that window in whole seconds, and `0`
402
402
  syncs before every command. The forge time does not count, so a forge that
403
403
  keeps failing does not make every command sync. A failed sync warns, `-q` and
404
404
  `--json` hide the warning, and the command goes on with the evidence it had.
@@ -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.11.0
7
+ set -gx WORKTREES_PLUGIN_VERSION 0.11.2
@@ -230,15 +230,16 @@ warning print before the next sync is due.
230
230
 
231
231
  Every command except `gw sync`, `gw version`, `gw list`, `gw fast-forward`,
232
232
  help and completion runs sync first when one is due: the default remote's
233
- refs time is null, or at least `WORKTREES_SYNC_TTL` seconds old. The TTL is 60 when the variable is unset or
233
+ refs time is null, or at least `WORKTREES_SYNC_TTL` seconds old. The TTL is 300 when the variable is unset or
234
234
  empty, takes whole seconds with `0` meaning every command, and anything else
235
235
  is a usage error at exit 2. The forge time is not read. Without a default
236
236
  remote nothing syncs first, since sync records nothing there. That sync's
237
237
  failures and warnings go to stderr as warnings, hidden under `-q` and
238
238
  `--json`; the command keeps its own stdout and exit status. `gw fast-forward`
239
- fetches the default remote on every run instead and asks the forge for the
240
- branch's newest merged request, and either failing is a refusal whose last
241
- line is the same command under `WORKTREES_OFFLINE=1`.
239
+ fetches the default remote instead when one is due, asks the forge for the
240
+ branch's newest merged request in every run, and fetches again when that
241
+ answer names a merge the head ref lacks. A failed fetch or forge query is a
242
+ refusal whose last line is the same command under `WORKTREES_OFFLINE=1`.
242
243
 
243
244
  `WORKTREES_OFFLINE` with a non-empty value turns every sync off. No command
244
245
  syncs first, `WORKTREES_SYNC_TTL` goes unread, and `gw sync` refuses at
@@ -14,9 +14,12 @@ gwff --json
14
14
  ## Fresh evidence
15
15
 
16
16
  A pull request merged on the forge a moment ago is the usual reason to run
17
- this, so it decides on evidence read in the same run. It fetches the default
18
- remote on every run, whatever `WORKTREES_SYNC_TTL` says, and asks the forge
19
- for the branch's newest merged request. The finished-branch proof and the
17
+ this. It fetches the default remote when the last fetch is
18
+ `WORKTREES_SYNC_TTL` seconds old, 5 minutes by default, and asks the forge
19
+ for the branch's newest merged request in every run. When that answer names
20
+ a merge commit the fetched head ref lacks, it fetches before deciding. On the
21
+ head branch it asks the forge nothing and moves to the head ref as the last
22
+ fetch left it; `gw sync` first fetches now. The finished-branch proof and the
20
23
  search for a merged part both use that answer; neither reads the request
21
24
  cached by `gw sync`. When nothing else marks where a merged part ends, it
22
25
  also asks which merged request carried the branch's oldest commit. When the
@@ -49,12 +52,17 @@ What it does depends on the branch, checked in this order:
49
52
  4. The head branch fast-forwards with `git merge --ff-only`. Local commits on
50
53
  it are refused and listed, because a rebase would rewrite them, with the
51
54
  two commands that move them to a branch of their own.
52
- 5. A branch that already contains the head ref is left alone: `current`.
53
- 6. A branch proved finished, by the checks
55
+ 5. A branch whose open request targets another branch whose own request is
56
+ still open, a stacked one, is levelled with that branch rather than the
57
+ head ref, from the local copy when there is one: `rebased`, with `base`
58
+ naming it, or `current` when it already holds that branch's tip. The
59
+ branch below levels with the head ref in its own run.
60
+ 6. A branch that already contains the head ref is left alone: `current`.
61
+ 7. A branch proved finished, by the checks
54
62
  [branch status](branch-status.md) runs or by a verified merged request,
55
63
  keeps its name and its commits. The checkout moves to a new branch from
56
64
  the head ref: `rotated`.
57
- 7. A branch whose first commits are in the head ref and which went on
65
+ 8. A branch whose first commits are in the head ref and which went on
58
66
  afterwards has a boundary: the newest commit below the tip with a proof,
59
67
  searched from the tip down, since the first of a squashed pair is not
60
68
  upstream on its own, or the source commit of a verified merged request.
@@ -78,15 +86,15 @@ What it does depends on the branch, checked in this order:
78
86
  where nothing says whose it was, the branch keeps its name and any
79
87
  request open from it, and drops the merged commits in place with the same
80
88
  `git rebase --onto`: `rebased`, with `carried` above zero.
81
- 8. A branch whose tip is on the head ref's first-parent history has no commits
89
+ 9. A branch whose tip is on the head ref's first-parent history has no commits
82
90
  of its own and fast-forwards: `fast-forwarded`.
83
- 9. A branch with commits of its own is rebased onto the head ref: `rebased`.
91
+ 10. A branch with commits of its own is rebased onto the head ref: `rebased`.
84
92
  The first commit that conflicts stops the rebase, and the files stay as
85
93
  git left them, markers included: `conflict`.
86
- 10. A branch whose state cannot be told, such as one with no history in common
94
+ 11. A branch whose state cannot be told, such as one with no history in common
87
95
  with the head ref, is refused.
88
96
 
89
- A branch in step 5, 7 or 9 whose remote copy was rewritten elsewhere takes
97
+ A branch in step 6, 8 or 10 whose remote copy was rewritten elsewhere takes
90
98
  that copy rather than being rebased. GitHub rewrites a stacked pull request's
91
99
  branch when the one below it merges: the same commits, committed again on the
92
100
  merge. The copy, `refs/remotes/REMOTE/BRANCH`, counts when no commit the
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worktrees",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "Read CI, rebase onto the head branch, describe, ship and merge pull requests, and prune finished worktrees through the worktrees CLI",
5
5
  "author": {
6
6
  "name": "Mihai Bojin",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worktrees",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "Read CI, rebase onto the head branch, describe, ship and merge pull requests, and prune finished worktrees through the worktrees CLI",
5
5
  "author": {
6
6
  "name": "Mihai Bojin",
@@ -58,7 +58,7 @@ uv tool install git-worktrees
58
58
  ```
59
59
 
60
60
  The skills need `jq`, and `gh` or `glab` signed in for the forge the remote
61
- is on. The plugin installs none of them. Skills call `gw` from `$PATH`.
61
+ is on; shipping a stack on GitHub needs `gh extension install github/gh-stack`. The plugin installs none of them. Skills call `gw` from `$PATH`.
62
62
 
63
63
  ## What runs without asking
64
64
 
@@ -116,6 +116,12 @@ head branch that holds commits its remote does not, it starts the branch on
116
116
  them, ships it, then puts the head branch back where its remote is and
117
117
  prints the command that undoes that.
118
118
 
119
+ Named branches that build on each other ship as a stack: each opens its
120
+ pull request on the one below with `gh stack link`, so GitHub links them
121
+ into a native stack, and they merge bottom first. On GitLab the merge
122
+ request targets the branch below. A stack needs the `gh-stack` extension on
123
+ GitHub.
124
+
119
125
  `/worktrees:ship-it 41 42` ships open pull requests instead, one at a time
120
126
  and a stack bottom first. Asking approves pushing fixes to each one's
121
127
  branch, correcting its description and merging it once green, fixing each
@@ -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.11.0",
4
+ "version": "0.11.2",
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",
@@ -67,8 +67,9 @@ before you ran anything, perhaps one the user paused in `git rebase -i`.
67
67
  Show its `stopped_at`, `subject` and `paths`, and ask before resolving or
68
68
  continuing it. Continue on your own only a rebase this request started.
69
69
 
70
- The command fetches and asks the forge on every run, so the head ref is the
71
- remote's. Under `WORKTREES_OFFLINE`, when `lastSync.refs` is null or more than
70
+ The command fetches once the last fetch is `WORKTREES_SYNC_TTL` seconds old,
71
+ and whenever the forge names a merge the head ref lacks. On the head branch,
72
+ after a merge, run `gw sync` first so it sees the remote's tip. Under `WORKTREES_OFFLINE`, when `lastSync.refs` is null or more than
72
73
  10 minutes old after the run, say the head ref can be behind the remote. Do
73
74
  not run `gw sync` yourself.
74
75
 
@@ -10,6 +10,7 @@
10
10
  "Bash(git push --force-with-lease --force-if-includes *)",
11
11
  "Bash(gh pr create *)",
12
12
  "Bash(gh pr edit *)",
13
+ "Bash(gh stack link *)",
13
14
  "Bash(gw merge *)",
14
15
  "Bash(gh run rerun *)",
15
16
  "Bash(glab mr create *)",
@@ -35,6 +35,7 @@ allowed-tools:
35
35
  - Bash(gh pr diff:*)
36
36
  - Bash(gh pr create:*)
37
37
  - Bash(gh pr edit:*)
38
+ - Bash(gh stack link:*)
38
39
  - Bash(gw merge:*)
39
40
  - Bash(gh run view:*)
40
41
  - Bash(gh run rerun:*)
@@ -96,8 +97,8 @@ Never edit those files yourself.
96
97
  With no arguments, work in the checkout the user is in, from step 1.
97
98
 
98
99
  Each named branch goes through steps 2 to 10 on its own, one after another
99
- in this worktree, and a branch built on another named branch goes after it.
100
- Step 2 commits the branch this worktree is on; then switch to the next:
100
+ in this worktree. Step 2 commits the branch this worktree is on; then
101
+ switch to the next:
101
102
 
102
103
  ```sh
103
104
  git switch --no-guess 'BRANCH'
@@ -113,6 +114,14 @@ back to the head branch after each push, `git switch --no-guess
113
114
  'HEAD_BRANCH'`, so it is never left on another branch. Naming the head branch is the same as no argument in the checkout that
114
115
  holds it.
115
116
 
117
+ Named branches that build on each other ship as a stack. A branch builds
118
+ on another named branch when its history holds that branch's tip and that
119
+ branch is not merged. Take the stack bottom first through steps 2 to 6,
120
+ each branch above opening its review on the one below as step 5 says, then
121
+ bottom first through steps 7 to 10. Once a branch's review is open on the
122
+ one below, `gw fast-forward` levels it with that branch rather than the
123
+ head branch.
124
+
116
125
  With numbers, each review goes through steps 7 to 10 on its own, one at a
117
126
  time in the order given, and a stack bottom first. One whose `pr.baseRef`
118
127
  is the branch of a review this run did not merge, whatever the reason, is
@@ -225,6 +234,21 @@ gh pr create --base 'HEAD_BRANCH' --head 'BRANCH' --title 'TITLE' --body-file FI
225
234
  glab mr create --target-branch 'HEAD_BRANCH' --source-branch 'BRANCH' --title 'TITLE' --description "$(cat FILE)" --yes
226
235
  ```
227
236
 
237
+ A branch that builds on the named branch below it opens its review on that
238
+ one instead. On GitHub, `gh stack link` pushes it, opens the pull request
239
+ on the one below and links the two into a native stack; on GitLab the merge
240
+ request targets the branch below:
241
+
242
+ ```sh
243
+ gh stack link 'BELOW' 'BRANCH' --open
244
+ glab mr create --target-branch 'BELOW' --source-branch 'BRANCH' --title 'TITLE' --description "$(cat FILE)" --yes
245
+ ```
246
+
247
+ Then run step 3 again, which now levels the branch with the one below, and
248
+ push it as step 4 does. `gh stack link` comes from the `gh-stack`
249
+ extension, `gh extension install github/gh-stack`; without it, a stacked
250
+ branch is a blocker.
251
+
228
252
  Then run [the describe-pr skill](../describe-pr/SKILL.md) on it.
229
253
 
230
254
  ## 6. Release note
@@ -272,7 +296,7 @@ the cause before changing anything:
272
296
  | the code or a test is wrong | fix it, run that test and the repository's checks |
273
297
  | formatting or generated files | run the repository's formatter or generator, read its diff |
274
298
  | a runner outage, a timeout, a flaky test shown to pass on retry | `gh run rerun RUN --failed` or `glab ci retry JOB`, once |
275
- | the base moved and the branch is out of date | steps 3 and 4 again, in the branch's worktree |
299
+ | the base moved and the branch is out of date | `gw sync`, then steps 3 and 4 again, in the branch's worktree |
276
300
 
277
301
  Never make a check pass by skipping, deleting or loosening it, and never
278
302
  edit CI configuration to get past a failure unless the configuration is
@@ -409,7 +433,7 @@ gw list --json | jq -c '(.head.ref // "" | sub("^refs/remotes/[^/]+/|^refs/heads
409
433
 
410
434
  A null `path` means no checkout holds it, and nothing needs moving. Else
411
435
  follow [the fast-forward skill](../fast-forward/SKILL.md) in that
412
- checkout, with `(cd 'PATH' && command gw fast-forward --json)`. On the head
436
+ checkout, with `(cd 'PATH' && gw sync && command gw fast-forward --json)`. On the head
413
437
  branch it only fast-forwards; a refusal that the branch is ahead of the
414
438
  remote is reported, never worked around. Offer
415
439
  [the prune skill](../prune/SKILL.md) for the merged branches; removing them
@@ -76,6 +76,11 @@ prefix_rule(
76
76
  decision="allow",
77
77
  justification="ship-it opens and describes the pull request",
78
78
  )
79
+ prefix_rule(
80
+ pattern=["gh", "stack", "link"],
81
+ decision="allow",
82
+ justification="ship-it opens a stacked pull request",
83
+ )
79
84
  prefix_rule(
80
85
  pattern=["gw", "merge"],
81
86
  decision="allow",
@@ -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.11.0"
12
+ version = "0.11.2"
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.
@@ -41,6 +41,13 @@ def _assessment_flags(p: argparse.ArgumentParser) -> None:
41
41
  p.add_argument("--complete", action="store_true", help=argparse.SUPPRESS)
42
42
 
43
43
 
44
+ def complete() -> int:
45
+ """Every local branch and its tip, for `gw branch status` and `prune`."""
46
+ for name, (sha, _) in branches.local_refs().items():
47
+ print(f"{name}\t{sha[:12]}")
48
+ return 0
49
+
50
+
44
51
  def delete_flags(p: argparse.ArgumentParser) -> None:
45
52
  p.add_argument("-v", "--verbose", action="store_true", help="print every command")
46
53
  _add_delete_flags(p)
@@ -65,8 +72,7 @@ def _prepare(
65
72
  ) -> tuple[str, str, str, str, list[branches.Verdict], set[str]] | None:
66
73
  options.verbose = args.verbose
67
74
  if args.complete:
68
- for name, (sha, _) in branches.local_refs().items():
69
- print(f"{name}\t{sha[:12]}")
75
+ complete()
70
76
  return None
71
77
  if args.explain:
72
78
  _explain()
@@ -73,6 +73,7 @@ def local_refs() -> dict[str, tuple[str, str]]:
73
73
  }
74
74
 
75
75
 
76
+ @merged.reusing
76
77
  def assess(
77
78
  names: list[str],
78
79
  head_sha: str,