mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 15:38:33 +02:00
Resolves #400 -- rebase --pull with just fast forward
This commit is contained in:
parent
f1f2a3a5b4
commit
8f3f32d82b
2 changed files with 19 additions and 6 deletions
|
@ -120,7 +120,7 @@ describe('Git Remotes', function() {
|
||||||
'{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":"o/master"},"side":{"target":"C3","id":"side","remoteTrackingBranchID":"o/side"},"o/master":{"target":"C2","id":"o/master","remoteTrackingBranchID":null},"o/side":{"target":"C3","id":"o/side","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C1"],"id":"C3"}},"HEAD":{"target":"side","id":"HEAD"},"originTree":{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":null},"side":{"target":"C3","id":"side","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C1"],"id":"C3"}},"HEAD":{"target":"master","id":"HEAD"}}}'
|
'{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":"o/master"},"side":{"target":"C3","id":"side","remoteTrackingBranchID":"o/side"},"o/master":{"target":"C2","id":"o/master","remoteTrackingBranchID":null},"o/side":{"target":"C3","id":"o/side","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C1"],"id":"C3"}},"HEAD":{"target":"side","id":"HEAD"},"originTree":{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":null},"side":{"target":"C3","id":"side","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C1"],"id":"C3"}},"HEAD":{"target":"master","id":"HEAD"}}}'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sets tracking when checking out remote branch', function() {
|
it('sets tracking when checking out remote branch', function() {
|
||||||
expectTreeAsync(
|
expectTreeAsync(
|
||||||
'git clone; git checkout -b side o/master;git fakeTeamwork;git pull',
|
'git clone; git checkout -b side o/master;git fakeTeamwork;git pull',
|
||||||
|
@ -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
|
/* 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() {
|
it('will correctly resolve the dependency order of commits when fetching or pushing', function() {
|
||||||
expectTreeAsync(
|
expectTreeAsync(
|
||||||
|
@ -405,4 +412,3 @@ describe('Git Remotes', function() {
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1423,13 +1423,20 @@ GitEngine.prototype.pullFinishWithRebase = function(
|
||||||
chain = chain.then(function() {
|
chain = chain.then(function() {
|
||||||
pendingFetch.dontResolvePromise = true;
|
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 {
|
try {
|
||||||
return this.rebase(remoteBranch, localBranch, pendingFetch);
|
return this.rebase(remoteBranch, localBranch, pendingFetch);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.filterError(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')) {
|
if (err.getMsg() !== intl.str('git-error-rebase-none')) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
@ -2087,6 +2094,7 @@ GitEngine.prototype.hgRebase = function(destination, base) {
|
||||||
|
|
||||||
GitEngine.prototype.rebase = function(targetSource, currentLocation, options) {
|
GitEngine.prototype.rebase = function(targetSource, currentLocation, options) {
|
||||||
// first some conditions
|
// first some conditions
|
||||||
|
debugger;
|
||||||
if (this.isUpstreamOf(targetSource, currentLocation)) {
|
if (this.isUpstreamOf(targetSource, currentLocation)) {
|
||||||
this.command.setResult(intl.str('git-result-uptodate'));
|
this.command.setResult(intl.str('git-result-uptodate'));
|
||||||
|
|
||||||
|
@ -3057,4 +3065,3 @@ exports.Commit = Commit;
|
||||||
exports.Branch = Branch;
|
exports.Branch = Branch;
|
||||||
exports.Tag = Tag;
|
exports.Tag = Tag;
|
||||||
exports.Ref = Ref;
|
exports.Ref = Ref;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue