git-commit-patch.py merges the selected tree against the staged tree directly:
git.run("merge-tree", "--write-tree", f"--merge-base={base_tree}", selected_tree, prior_tree)
Git only learned to accept tree arguments there at some point after 2.43. On 2.43 the merge fails and the whole patch commit is refused:
git-commit-patch: patch overlaps staged changes; HEAD and the shared index are unchanged
error: 9f8ae23686f67ca9c0711b7c784e8162c4218a3f: expected commit type, but the object dereferences to tree type
merge-tree: 9f8ae23686f67ca9c0711b7c784e8162c4218a3f - not something we can merge
The reported message is wrong twice over. There is no overlap; the merge never ran. And the advice it implies, that the user should unstage something, does not help.
Reproduced on git 2.43.0 with the empty tree, so it is the argument type and nothing about the patch:
$ E=4b825dc642cb6eb9a060e54bf8d69288fbee4904
$ git merge-tree --write-tree --merge-base=$E $E $E
error: 4b825dc642cb6eb9a060e54bf8d69288fbee4904: expected commit type, but the object dereferences to tree type
Ubuntu 24.04 ships git 2.43, so every cloud VM and container on that base loses devrun task commit-patch entirely. devrun task commit is unaffected: it does not merge trees.
Suggested fix
Wrap each tree in a throwaway commit with git commit-tree and merge the commits, which every Git carrying --write-tree (2.38 and later) accepts. The commits are unreferenced and cost a gc nothing. It is a change to three arguments, not to the index, hook, or recovery machinery around them.
Failing that, detect the condition and say so, rather than reporting an overlap that did not happen.
Acceptance criteria
Notes
#77 added a capability probe that skips that test where merge-tree will not take trees, so the suite is green on an old Git instead of failing with a misleading message. Remove the probe and the skip when this is fixed.
git-commit-patch.pymerges the selected tree against the staged tree directly:Git only learned to accept tree arguments there at some point after 2.43. On 2.43 the merge fails and the whole patch commit is refused:
The reported message is wrong twice over. There is no overlap; the merge never ran. And the advice it implies, that the user should unstage something, does not help.
Reproduced on git 2.43.0 with the empty tree, so it is the argument type and nothing about the patch:
Ubuntu 24.04 ships git 2.43, so every cloud VM and container on that base loses
devrun task commit-patchentirely.devrun task commitis unaffected: it does not merge trees.Suggested fix
Wrap each tree in a throwaway commit with
git commit-treeand merge the commits, which every Git carrying--write-tree(2.38 and later) accepts. The commits are unreferenced and cost agcnothing. It is a change to three arguments, not to the index, hook, or recovery machinery around them.Failing that, detect the condition and say so, rather than reporting an overlap that did not happen.
Acceptance criteria
devrun task commit-patchcommits a patch and preserves unrelated staging on git 2.43.test_devkit_commits_patch_and_preserves_unrelated_stagingruns rather than skips on git 2.43.Notes
#77 added a capability probe that skips that test where
merge-treewill not take trees, so the suite is green on an old Git instead of failing with a misleading message. Remove the probe and the skip when this is fixed.