Subtree Split Includes Commits Outside Prefix Directory
I attempt a subtree push to a sub-project which I knew not to have had
any local modification since the last subtree push it had received,
but it failed.
! [rejected] 5a9ad640651d3d54387afa5b7eaf89ed0b392a01 ->
error: failed to push some refs to 'subproject'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
The first step I took to understand the cause was to do a subtree
split and inspect the commit history of the resulting branch. I found
that it contained commits that did not touch any files in the
subproject. Doing a git show on these commits revealed that they were
not empty commits, but contained diff information for paths in the
main project, and in some cases, other subprojects that exist in the
So you're saying that this patch caused a regression?
> Unfortunately, I have not yet reproduced this with a test main project
> and subprojects, and I cannot make the project I observed it in
I very much want to see a testcase for this. I'm planning to
fundamentally rewrite the split code this year and want to make sure it
covers everything it does now and fixes a few bugs that have been
It's tough to revert that patch since it fixed a problem for someone and
we don't have a testcase demonstrating the problem you encountered. Not
saying your problem isn't important but we need to understand it and
have a way to flag it before fixing or hiding it with a revert of the