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

Offen
#301 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
50/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
java
Bereich
devtools

Rechercherichtung

Start in org.eclipse.jgit.api.CherryPickCommand and RevertCommand, at the point where CHERRY_PICK_HEAD/REVERT_HEAD is written when a multi-commit sequence is interrupted by a conflict. Study the sequencer/{todo,head,opts,abort-safety} semantics listed in the issue and locate where in the repository/RefDirectory layer such state files should be persisted. Done means a multi-commit cherry-pick or revert interrupted mid-sequence leaves a valid, git-compatible sequencer state (unsupported opts in sequencer/opts throw), single-commit operations still write only CHERRY_PICK_HEAD/REVERT_HEAD, and new tests alongside the existing cherry-pick/revert command tests cover this.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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 https://github.com/eclipse-egit/egit/issues/192).

Vorherrschende Sprache
Java
Sterne
427
Forks
116
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus eclipse-jgit/jgit

Alle Issues in eclipse-jgit/jgit

Ähnliche Issues

Weitere Issues zu Java

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.