subtree: use commits before rejoins for splits
commit315a84f9aa0e2e629b0680068646b0032518ebed
authorStrain, Roger L <roger.strain@swri.org>
Fri, 28 Sep 2018 18:35:39 +0000 (28 13:35 -0500)
committerJunio C Hamano <gitster@pobox.com>
Sat, 6 Oct 2018 23:09:34 +0000 (7 08:09 +0900)
treefdb127713a7c1410772d06fe69f2ea9d3cafaaaf
parentdd21d43b58ee3ce1b9801b5121fead0298961be1
subtree: use commits before rejoins for splits

Adds recursive evaluation of parent commits which were not part of the
initial commit list when performing a split.

Split expects all relevant commits to be reachable from the target commit
but not reachable from any previous rejoins. However, a branch could be
based on a commit prior to a rejoin, then later merged back into the
current code. In this case, a parent to the commit will not be present in
the initial list of commits, trigging an "incorrect order" warning.

Previous behavior was to consider that commit to have no parent, creating
an original commit containing all subtree content. This commit is not
present in an existing subtree commit graph, changing commit hashes and
making pushing to a subtree repo impossible.

New behavior will recursively check these unexpected parent commits to
track them back to either an earlier rejoin, or a true original commit.
The generated synthetic commits will properly match previously-generated
commits, allowing successful pushing to a prior subtree repo.

Signed-off-by: Strain, Roger L <roger.strain@swri.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/subtree/git-subtree.sh