chiark / gitweb /
stg repair: Patchify non-patch commits between patches
This teaches "stg repair" to find non-patch commits that sit between
patches, and turn them into patches. This situation can happen e.g.
like this:
stg new -m A && stg new -m B && stg new -m C
stg pop A B C
stg push B
echo foo > foo && git add foo && stg refresh
git reset --hard $(stg id C)
The old "stg repair" would at this point simply conclude that A and C
are applied, and B unapplied. However, B's old commit is still between
them even though it's not a patch, which will cause problems later --
StGit generally assumes that the applied patches are a consecutive
string of commits. The new "stg repair", on the other hand, will find
B's old commit, and create a new patch for it.
One downside of this change is that we can no longer conclude that all
is well just because head == top, so no-op runs of "stg repair" just
got more expensive.
Signed-off-by: Karl Hasselström <kha@treskal.com>