Repair `stg repair` with amended first patch
commit879b5c26b2529c8ae579c8c7588f99772a893419
authorPeter Grayson <pete@jpgrayson.net>
Wed, 8 Dec 2021 16:30:14 +0000 (8 11:30 -0500)
committerPeter Grayson <pete@jpgrayson.net>
Wed, 8 Dec 2021 18:04:41 +0000 (8 13:04 -0500)
tree9f0bcbe1636a1ee6eead271151ba32cee94f4525
parent043b19dc5219b0f9f25b2452f92c3d4a058d3faf
Repair `stg repair` with amended first patch

When `stg repair` searches for commits to "patchify", it looks for
commits that are children of known patch commits. This left an unhandled
edge case where if only one patch was applied, and that patch was
amended with `git commit --amend`, the amended commit would not be
patchified and, worse, that commit would become orphaned.

`stg repair` is modified to look for the last known stack base commit in
addition to known patch commits such that children of the base commit
will now be patchified.

An added benefit of identifying the stack's base commit is that it
signals the point beyond which no patches will be found and thus allows
searching to stop and a potentially large amount of work avoided. This
can have a significant impact on the performance of running `stg repair`
in a repositories with long histories.

Repairs #163

Signed-off-by: Peter Grayson <pete@jpgrayson.net>
stgit/commands/repair.py
t/t1307-repair-amend.sh [new file with mode: 0755]