Resolves #400 -- rebase --pull with just fast forward

This commit is contained in:
Peter Cottle 2016-12-04 10:17:15 -08:00
parent f1f2a3a5b4
commit 8f3f32d82b
2 changed files with 19 additions and 6 deletions

View file

@ -374,6 +374,13 @@ describe('Git Remotes', function() {
);
});
it('pulls with rebase in other weird situation with just fast forward', function() {
expectTreeAsync(
'git clone; git fakeTeamwork; git pull --rebase',
'{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":"o/master"},"o/master":{"target":"C2","id":"o/master","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"tags":{},"HEAD":{"target":"master","id":"HEAD"},"originTree":{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"tags":{},"HEAD":{"target":"master","id":"HEAD"}}}'
);
});
/* TODO -- enable this back when we have better async tree compare, it takes too long right now
it('will correctly resolve the dependency order of commits when fetching or pushing', function() {
expectTreeAsync(
@ -405,4 +412,3 @@ describe('Git Remotes', function() {
});

View file

@ -1423,13 +1423,20 @@ GitEngine.prototype.pullFinishWithRebase = function(
chain = chain.then(function() {
pendingFetch.dontResolvePromise = true;
// Lets move the git pull --rebase check up here.
if (this.isUpstreamOf(localBranch, remoteBranch)) {
this.setTargetLocation(
localBranch,
this.getCommitFromRef(remoteBranch)
);
this.checkout(localBranch);
return this.animationFactory.playRefreshAnimation(this.gitVisuals);
}
try {
return this.rebase(remoteBranch, localBranch, pendingFetch);
} catch (err) {
this.filterError(err);
// we make one exception here to match the behavior of
// git pull --rebase. If the rebase is empty we just
// simply checkout the new location
if (err.getMsg() !== intl.str('git-error-rebase-none')) {
throw err;
}
@ -2087,6 +2094,7 @@ GitEngine.prototype.hgRebase = function(destination, base) {
GitEngine.prototype.rebase = function(targetSource, currentLocation, options) {
// first some conditions
debugger;
if (this.isUpstreamOf(targetSource, currentLocation)) {
this.command.setResult(intl.str('git-result-uptodate'));
@ -3057,4 +3065,3 @@ exports.Commit = Commit;
exports.Branch = Branch;
exports.Tag = Tag;
exports.Ref = Ref;