Browse Source

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 <thomas.wolf@paranor.ch>
tags/v5.3.0.201903061415-rc1
Thomas Wolf 5 years ago
parent
commit
38e5a75ce4
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

+ 5
- 1
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java View File

@@ -180,6 +180,10 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
/**
* The folder containing the hashes of (potentially) rewritten commits when
* --preserve-merges is used.
* <p>
* Native git rebase --merge uses a <em>file</em> of that name to record
* commits to copy notes at the end of the whole rebase.
* </p>
*/
private static final String REWRITTEN = "rewritten"; //$NON-NLS-1$

@@ -292,7 +296,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
}
this.upstreamCommit = walk.parseCommit(repo
.resolve(upstreamCommitId));
preserveMerges = rebaseState.getRewrittenDir().exists();
preserveMerges = rebaseState.getRewrittenDir().isDirectory();
break;
case BEGIN:
autoStash();

Loading…
Cancel
Save