From 38e5a75ce49abe7068e4612f4159902114ca951f Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Wed, 19 Dec 2018 11:34:35 +0100 Subject: [PATCH] RebaseCommand: tighten check for --preserve-merges on --continue With native git, .git/rebase-merge/rewritten exists actually in two different cases: * as a file in git rebase --merge recording OIDs for copying notes * as a directory in git rebase --preserve-merges Add a comment, and check for isDirectory() instead of exists(). Bug: 511487 Change-Id: I6a3317b4234d4f41c41b3004cdc7ea0abf2c6223 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 9e83fc73d..0e3d000d3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -180,6 +180,10 @@ public class RebaseCommand extends GitCommand { /** * The folder containing the hashes of (potentially) rewritten commits when * --preserve-merges is used. + *

+ * Native git rebase --merge uses a file of that name to record + * commits to copy notes at the end of the whole rebase. + *

*/ private static final String REWRITTEN = "rewritten"; //$NON-NLS-1$ @@ -292,7 +296,7 @@ public class RebaseCommand extends GitCommand { } this.upstreamCommit = walk.parseCommit(repo .resolve(upstreamCommitId)); - preserveMerges = rebaseState.getRewrittenDir().exists(); + preserveMerges = rebaseState.getRewrittenDir().isDirectory(); break; case BEGIN: autoStash();