Skip to content

fix: keep files of nested repos as upstream has them, with -text in .gitattributes - #225

Merged
thorsten-klein merged 1 commit into
mainfrom
fix/keep-upstream-bytes
Nov 14, 2026
Merged

thorsten-klein merged 1 commit into
mainfrom
fix/keep-upstream-bytes

Conversation

@thorsten-klein

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

Copy link
Copy Markdown
Owner

What this changes

After a clone or pull, git-nested adds -text to the root .gitattributes
for files that a rule there would change. This gets a commit of its own. The
files stay as upstream has them.

Why

For a submodule, the parent's .gitattributes does not count. For a nested
repo it does. A rule like *.bat text eol=crlf then shows upstream's CRLF
files as changed. The tree is never clean, and the next pull refuses.

Stack: #223 → #224 → #225 → #226 → #202.

Checklist

  • uv run poe all passes (ruff, mypy, pyright, bandit, complexipy, and the
    tests at 100% coverage)
  • New behaviour has a test
  • README / --help / the man page updated, if the change is visible to users
  • The PR title reads as a Conventional Commit
    (feat:, fix:, docs:, …) — it becomes the squash-merge commit message
    and the changelog line

@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 (2bdab93) to head (497fbad).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #225   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           50        50           
  Lines         2863      2894   +31     
=========================================
+ Hits          2863      2894   +31     
Files with missing lines Coverage Δ
src/git_nested/commands/clone.py 100.00% <100.00%> (ø)
src/git_nested/commands/pull.py 100.00% <100.00%> (ø)
src/git_nested/content.py 100.00% <100.00%> (ø)

thorsten-klein added a commit that referenced this pull request Nov 14, 2026
## What this changes

`pull` and `commit` keep the local changes of nested repos inside a
nested
repo.

- Before, `pull` cloned inner nested repos again. Their local changes
were
lost. Now they come back from HEAD. Then each one is pulled to its new
pin.
- `commit` does the same after you finish a pull by hand.
- No commit has a gitlink where a nested repo belongs. `clone
  --recurse-submodules` made one for a moment.
- `pull --force` still drops all local changes.
- If an inner repo stops on conflicts, a new pull does the rest.

## Why

Found while working on #184. The `submodules` command (#202) builds on
it.

Stack: #223 (this) → #224 → #225 → #226 → #202.

## Checklist

- [x] `uv run poe all` passes (ruff, mypy, pyright, bandit, complexipy,
and the
      tests at 100% coverage)
- [x] New behaviour has a test
- [x] README / `--help` / the man page updated, if the change is visible
to users
- [x] The PR title reads as a [Conventional
Commit](https://www.conventionalcommits.org)
(`feat:`, `fix:`, `docs:`, …) — it becomes the squash-merge commit
message
      and the changelog line
@thorsten-klein thorsten-klein changed the title fix: keep files of nested repos as upstream has them fix: keep files of nested repos as upstream has them, with -text in .gitattributes Nov 14, 2026
@thorsten-klein
thorsten-klein force-pushed the fix/subdir-in-commit-subject branch from d2f6e00 to 5e7f954 Compare November 14, 2026 07:32
thorsten-klein added a commit that referenced this pull request Nov 14, 2026
…ed pull <subdir>` (#224)

## What this changes

The subject of a nested commit names the subdir: `git nested pull
<subdir>`
instead of `git nested pull`.

## Why

A sync of many nested repos makes many commits. With the same subject
for
each, `git log --oneline` can't tell them apart.

Stack: #223 → #224 → #225 → #226 → #202.

## Checklist

- [x] `uv run poe all` passes (ruff, mypy, pyright, bandit, complexipy,
and the
      tests at 100% coverage)
- [x] New behaviour has a test
- [x] README / `--help` / the man page updated, if the change is visible
to users
- [x] The PR title reads as a [Conventional
Commit](https://www.conventionalcommits.org)
(`feat:`, `fix:`, `docs:`, …) — it becomes the squash-merge commit
message
      and the changelog line
Base automatically changed from fix/subdir-in-commit-subject to main November 14, 2026 07:46
For a submodule, the parent's .gitattributes does not count. For a
nested repo it does. A rule like `*.bat text eol=crlf` then shows
upstream's CRLF files as changed. The tree is never clean, and the next
pull refuses.

After a clone or pull, git-nested now adds `-text` for these files to
the root .gitattributes, in a commit of its own. The content stays as
upstream has it.
@thorsten-klein
thorsten-klein force-pushed the fix/keep-upstream-bytes branch from 00ac107 to 497fbad Compare November 14, 2026 07:49
@sonarqubecloud

Copy link
Copy Markdown

@thorsten-klein
thorsten-klein merged commit 149038a into main Nov 14, 2026
24 checks passed
@thorsten-klein
thorsten-klein deleted the fix/keep-upstream-bytes branch November 14, 2026 08:02
thorsten-klein added a commit that referenced this pull request Nov 14, 2026
…226)

## What this changes

A relative submodule url resolves right against a local Windows path.

## Why

A local remote on Windows can have backslashes. `posixpath` took the
whole
path as one name, so `../foo` became just `foo`.

Stack: #223 → #224 → #225 → #226 → #202.

## Checklist

- [x] `uv run poe all` passes (ruff, mypy, pyright, bandit, complexipy,
and the
      tests at 100% coverage)
- [x] New behaviour has a test
- [x] README / `--help` / the man page updated, if the change is visible
to users
- [x] The PR title reads as a [Conventional
Commit](https://www.conventionalcommits.org)
(`feat:`, `fix:`, `docs:`, …) — it becomes the squash-merge commit
message
      and the changelog line
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.

1 participant