Skip to content

feat: branch --from-patches builds the nested branch from the patches - #216

Merged
thorsten-klein merged 1 commit into
mainfrom
feat/208-from-patches
Nov 13, 2026
Merged

thorsten-klein merged 1 commit into
mainfrom
feat/208-from-patches

Conversation

@thorsten-klein

@thorsten-klein thorsten-klein commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Fixes #208

Based on #215. Part 5 of 5.

What

git nested branch --from-patches <subdir> builds the nested branch as the upstream commit plus one commit per patch. Each commit has the author, date and message of its patch. It stops if the result is not what HEAD has: a change not in a patch, or a missing patch. Not with -S.

This also covers #207: build the branch, cherry-pick one commit onto upstream, and push it with plain git.

Docs

doc/cli/branch.md, and two "Common tasks" in the patches guide: look at the patches as commits, and offer one patch upstream.

Tests

One commit per patch with its author, a change not in a patch, a missing patch, no patches, a refused filter, and -S.

@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e5d04be) to head (02fd01e).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              main      #216    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           49        49            
  Lines         2525      2713   +188     
==========================================
+ Hits          2525      2713   +188     
Files with missing lines Coverage Δ
src/git_nested/cli/parser.py 100.00% <ø> (ø)
src/git_nested/cli/spec.py 100.00% <ø> (ø)
src/git_nested/commands/branch.py 100.00% <100.00%> (ø)
src/git_nested/content.py 100.00% <100.00%> (ø)
src/git_nested/models.py 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

@thorsten-klein
thorsten-klein force-pushed the feat/211-patches-ignore branch from e0d019e to 3d0dff6 Compare November 13, 2026 20:02
thorsten-klein added a commit that referenced this pull request Nov 13, 2026
… repo as patch files (#212)

Fixes #198

First of five stacked PRs for the patches. Each builds on the one
before: #212 → #213 → #214 → #215 → #216.

## What

- New field `patches: <path>` in `.gitnested`: the folder with the local
changes as patch files, relative to the subdir. Without it, the patches
are off.
- New command `git nested patches create [<subdir>]`:
  - applies the patches on the upstream commit with `git am`,
  - writes what HEAD has on top as one more patch, with a TODO title,
- writes all patches again in one form: no commit id, no signature,
named after the title.
- The folder is never pushed. `diff` and `status` do not count it.
- Nested repos inside the subdir are left out. They can have their own
folder.
- `verify --patches` applies patches with `git am` now, so a plain diff
given as a patch is refused. `--diffs` still uses `git apply`.
- New module `patchbuild.py`: the temporary worktree, `git am`, and
writing the patches. `verify` uses it too.

## Docs

New page `doc/cli/patches.md` and guide `doc/guides/patches.md`. Updated
the `.gitnested` reference, `config`, `verify`, the man page and the
call diagrams.

## Tests

New `tests/e2e/test_patches.py`. The full suite passes with 100%
coverage.
@thorsten-klein
thorsten-klein force-pushed the feat/211-patches-ignore branch 2 times, most recently from 35764e3 to a40316c Compare November 13, 2026 20:54
Base automatically changed from feat/211-patches-ignore to main November 13, 2026 20:54
@thorsten-klein
thorsten-klein merged commit 1ec12b3 into main Nov 13, 2026
13 of 19 checks passed
@thorsten-klein
thorsten-klein deleted the feat/208-from-patches branch November 13, 2026 20:55
@sonarqubecloud

Copy link
Copy Markdown

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.

Support branch --from-patches to build the nested branch from the patches

1 participant