Description
JGit's CherryPickCommand and RevertCommand currently only track a single in-progress operation via CHERRY_PICK_HEAD/REVERT_HEAD. When multiple commits are included in one call and a conflict interrupts the sequence partway through, JGit has no way to record which commits are still pending, so the operation can't be resumed, skipped, or aborted compatibly with native Git's git cherry-pick --continue/--skip/--abort (or vice versa).
Motivation
Native Git tracks multi-commit cherry-pick/revert sequences in $GIT_DIR/sequencer/{todo,head,opts,abort-safety}.
These files have the following semantics / include the following information:
head — the original HEAD before the sequence started.
todo — the remaining pick/revert <abbrev-sha> <subject> lines, rewritten before each commit is applied.
opts — the replay options used during pick/revert, stored in git-config format
abort-safety — the HEAD commit expected after each step, updated after every successful pick/revert.
JGit's CherryPickCommand and RevertCommand currently only support the strategy, no-commit and mainline options, so only these options would need to be persisted in sequencer/opts for now. If future support for --continue/--skip/--abort is added to JGit, encountering options not yet handled by JGit must be considered and handled appropriately (e.g. by throwing an exception).
If a cherry-pick/revert involves more than one commit, JGit must write/maintain the sequencer state throughout the pick/revert sequence. Single-commit operations do not write sequencer states and continues to only write CHERRY_PICK_HEAD/REVERT_HEAD.
Additional context
Persisting the sequencer state enables future JGit / EGit --continue/--skip/--abort support for multi-commit cherry-picks / reverts. This again is a pre-requisite for implementing multi-commit cherry-picks via the EGit UI (work started and currently blocked in eclipse-egit/egit#192).
Description
JGit's
CherryPickCommandandRevertCommandcurrently only track a single in-progress operation viaCHERRY_PICK_HEAD/REVERT_HEAD. When multiple commits are included in one call and a conflict interrupts the sequence partway through, JGit has no way to record which commits are still pending, so the operation can't be resumed, skipped, or aborted compatibly with native Git'sgit cherry-pick --continue/--skip/--abort(or vice versa).Motivation
Native Git tracks multi-commit cherry-pick/revert sequences in
$GIT_DIR/sequencer/{todo,head,opts,abort-safety}.These files have the following semantics / include the following information:
head— the original HEAD before the sequence started.todo— the remainingpick/revert <abbrev-sha> <subject>lines, rewritten before each commit is applied.opts— the replay options used duringpick/revert, stored in git-config formatabort-safety— the HEAD commit expected after each step, updated after every successful pick/revert.JGit's
CherryPickCommandandRevertCommandcurrently only support thestrategy,no-commitandmainlineoptions, so only these options would need to be persisted insequencer/optsfor now. If future support for--continue/--skip/--abortis added to JGit, encountering options not yet handled by JGit must be considered and handled appropriately (e.g. by throwing an exception).If a cherry-pick/revert involves more than one commit, JGit must write/maintain the sequencer state throughout the
pick/revertsequence. Single-commit operations do not write sequencer states and continues to only writeCHERRY_PICK_HEAD/REVERT_HEAD.Additional context
Persisting the sequencer state enables future JGit / EGit
--continue/--skip/--abortsupport for multi-commit cherry-picks / reverts. This again is a pre-requisite for implementing multi-commit cherry-picks via the EGit UI (work started and currently blocked in eclipse-egit/egit#192).