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>
stable-5.4
Thomas Wolf 6 years ago committed by David Pursehouse
parent
commit
38e5a75ce4
  1. 6
      org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

6
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java

@ -180,6 +180,10 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
/** /**
* The folder containing the hashes of (potentially) rewritten commits when * The folder containing the hashes of (potentially) rewritten commits when
* --preserve-merges is used. * --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$ private static final String REWRITTEN = "rewritten"; //$NON-NLS-1$
@ -292,7 +296,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
} }
this.upstreamCommit = walk.parseCommit(repo this.upstreamCommit = walk.parseCommit(repo
.resolve(upstreamCommitId)); .resolve(upstreamCommitId));
preserveMerges = rebaseState.getRewrittenDir().exists(); preserveMerges = rebaseState.getRewrittenDir().isDirectory();
break; break;
case BEGIN: case BEGIN:
autoStash(); autoStash();

Loading…
Cancel
Save