Skip to content

Keep a moved submodule as its commit change in local patches - #106

Open
iguigova wants to merge 1 commit into
prooflinedev:mainfrom
iguigova:pin-diff-submodule
Open

iguigova wants to merge 1 commit into
prooflinedev:mainfrom
iguigova:pin-diff-submodule

Conversation

@iguigova

Copy link
Copy Markdown

Fixes #105.

Who it helps

Anyone who runs proofline review on local changes in a repository with submodules, with diff.submodule set in their git config. log makes the review refuse to start with an invalid-diff error. diff is worse: the review starts and uploads the submodule's own files in place of the submodule change.

What changes

diff() in src/git.rs passes --submodule=short, next to the other settings it pins because the server depends on them. A moved submodule is always the one Subproject commit change, whatever the person's git config says. Without the setting, the patch is the same as before.

Decisions

  • A flag, not a -c setting. --submodule=short on the command line overrides diff.submodule and needs no config key.
  • The fix is in diff(), which builds every patch. Local changes and pushed commits both go through it, so both are covered.

How I verified it

  • A new test in src/git.rs moves a submodule and sets diff.submodule to short, log and diff in turn. Each time, the patch must have one header, diff --git a/lib b/lib, with a Subproject commit hunk and none of the submodule's file contents. Without the flag, log fails as an invalid diff, and diff gives ["diff --git a/lib/f b/lib/f"].
  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo test --locked (157 passed, 1 ignored; 156 before) and cargo deny check with cargo-deny 0.20.2 all pass.
  • cargo mutants --in-diff: 1 mutant, killed.

🤖 Generated with Claude Code

A person's diff.submodule setting reshaped the patch: "log" dropped the
submodule's diff header, so the review was refused as an invalid diff,
and "diff" inlined the submodule's own files, which passed the header
check and were uploaded in place of the gitlink change. Pin
--submodule=short beside the other settings the server depends on.

Fixes prooflinedev#105.

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

This branch has not been deployed

No deployments
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.

A local review uploads a submodule's own files when diff.submodule is set

1 participant