Skip to content

Add sequencer support for multi-commit cherry-picking / revert #301

Description

@r-mennig

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions