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

未關閉
#301 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
50/100
Issue 類型
功能
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
java
領域
devtools

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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

主要語言
Java
星號
427
分支
116
PR 合併指標
30 天內沒有已合併 PR

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

eclipse-jgit/jgit 的其他 Issue

查看 eclipse-jgit/jgit 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。