Skip to content

fix(gitplumb): git-version fallback for cat-file -Z + tests - #26

Merged
sagenschneider merged 1 commit into
mainfrom
test-pr18
Sep 17, 2026
Merged

sagenschneider merged 1 commit into
mainfrom
test-pr18

Conversation

@sagenschneider

@sagenschneider sagenschneider commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up hardening on top of #18 (now merged), which switched blob() to cat-file --batch -Z.

-Z requires git ≥ 2.42 (Aug 2023); on older git cat-file --batch -Z exits non-zero on the unknown option, the persistent batch process dies on startup, and every blob() silently returns None (verified on debian:bookworm-slim / git 2.39: exit 129). Because the Action is a composite action it runs on the runner's git, not the Docker image — so ubuntu-22.04 runners (git 2.34), self-hosted runners on older LTS, and standalone pip install users are exposed.

GitRepo now probes -Z support once and falls back to the newline protocol when unavailable: git ≥ 2.42 keeps the newline-in-filename fix from #18, older environments keep working with no regression (the rare newline-in-filename case simply stays unfixed there).

Adds tests/test_gitplumb.py: a newline-in-filename blob() read (skipped when -Z is unsupported) and a fallback-protocol read.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Change impact: 13,076 ✅ OK

field value
files changed 2
scope vs origin/main (merge-base..HEAD)

Files to consider for refactoring

cost file existing new fns changed fns new
6,479 impact_gate/core/gitplumb.py 5,087 1,392 3 1
59 tests/test_gitplumb.py 0 59 0 2

The -Z (NUL-delimited) protocol needs git >= 2.42; older git exits non-zero on
the unknown option, which would silently break every blob() read. GitRepo now
probes -Z support once and falls back to the newline protocol when unavailable,
so older environments (common LTS distros, self-hosted runners, standalone
installs) keep working. The newline-in-filename fix applies wherever -Z is
supported; where it is not, behaviour is unchanged from before this series.

Adds tests/test_gitplumb.py: a newline-in-filename read (skipped when -Z is
unsupported) and a fallback-protocol read.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sagenschneider sagenschneider changed the title fix(gitplumb): NUL-delimited cat-file with -Z fallback + tests (closes #12) fix(gitplumb): git-version fallback for cat-file -Z + tests Sep 17, 2026
@sagenschneider
sagenschneider merged commit 32f8080 into main Sep 17, 2026
5 checks passed
sagenschneider added a commit that referenced this pull request Sep 17, 2026
0.3.1 was published to PyPI from a commit missing the cat-file -Z version
fallback (#26); 0.3.2 releases the corrected main. 0.3.1 should be yanked.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@alborworld

alborworld commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the fast review and merges across all six, much appreciated!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants