chiark / gitweb /
stg repair: Patchify non-patch commits between patches
authorKarl Hasselström <kha@treskal.com>
Sun, 11 Nov 2007 12:39:12 +0000 (13:39 +0100)
committerKarl Hasselström <kha@treskal.com>
Sun, 11 Nov 2007 13:44:28 +0000 (14:44 +0100)
commit490add07e9490b2654d22ca2cd3b8dcc0cc0cc9b
treed870da78ed0944e7a87bd5c66321e56daebcb3b8
parent051090dd538aa6c025a22ae896e2af1713e1522f
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>
stgit/commands/repair.py