RebaseCommand: use orig-head in addition to head

Since 2011-02-10 (i.e., git 1.7.6)[1] native git uses "orig-head" for
REBASE_HEAD. JGit was still using "head". Currently native git has a
legacy fall-back for reading this, but for how long? Let's write to
both. Note that JGit never reads this file.

[1] https://github.com/git/git/commit/84df4560

Bug: 511487
Change-Id: Id3742bf9bbc0001d850e801b26cc8880e646abfc
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
This commit is contained in:
Thomas Wolf 2018-12-19 11:07:43 +01:00 committed by David Pursehouse
parent a64fa0bd7f
commit b4c212309b
1 changed files with 5 additions and 1 deletions

View File

@ -162,7 +162,10 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
private static final String PATCH = "patch"; //$NON-NLS-1$
private static final String REBASE_HEAD = "head"; //$NON-NLS-1$
private static final String REBASE_HEAD = "orig-head"; //$NON-NLS-1$
/** Pre git 1.7.6 file name for {@link #REBASE_HEAD}. */
private static final String REBASE_HEAD_LEGACY = "head"; //$NON-NLS-1$
private static final String AMEND = "amend"; //$NON-NLS-1$
@ -1120,6 +1123,7 @@ else if (!isInteractive() && walk.isMergedInto(headCommit, upstream)) {
repo.writeOrigHead(headId);
rebaseState.createFile(REBASE_HEAD, headId.name());
rebaseState.createFile(REBASE_HEAD_LEGACY, headId.name());
rebaseState.createFile(HEAD_NAME, headName);
rebaseState.createFile(ONTO, upstreamCommit.name());
rebaseState.createFile(ONTO_NAME, upstreamCommitName);