From b4c212309b27c01dcf1a859774f6a0dc0a2338a5 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Wed, 19 Dec 2018 11:07:43 +0100 Subject: [PATCH] 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 --- .../src/org/eclipse/jgit/api/RebaseCommand.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java index 416a6c2dfc..4d3f2d9831 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -162,7 +162,10 @@ public class RebaseCommand extends GitCommand { 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 @@ public class RebaseCommand extends GitCommand { 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); -- 2.39.5