mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-09 14:14:27 +02:00
introduced bug with rebasing on HEAD from checking out too early
This commit is contained in:
parent
bebe06baa4
commit
8f396de98d
1 changed files with 10 additions and 7 deletions
17
src/git.js
17
src/git.js
|
@ -735,17 +735,17 @@ GitEngine.prototype.rebaseStarter = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
||||||
// git for some reason always checks out the branch you are rebasing,
|
|
||||||
// no matter the result of the rebase
|
|
||||||
this.checkout(currentLocation);
|
|
||||||
|
|
||||||
var targetObj = this.resolveID(targetSource);
|
var targetObj = this.resolveID(targetSource);
|
||||||
|
|
||||||
// first some conditions
|
// first some conditions
|
||||||
if (this.isUpstreamOf(targetSource, currentLocation)) {
|
if (this.isUpstreamOf(targetSource, currentLocation)) {
|
||||||
throw new CommandResult({
|
this.command.setResult('Branch already up-to-date');
|
||||||
msg: 'Branch already up-to-date'
|
|
||||||
});
|
// git for some reason always checks out the branch you are rebasing,
|
||||||
|
// no matter the result of the rebase
|
||||||
|
this.checkout(currentLocation);
|
||||||
|
// returning instead of throwing makes a tree refresh
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isUpstreamOf(currentLocation, targetSource)) {
|
if (this.isUpstreamOf(currentLocation, targetSource)) {
|
||||||
|
@ -754,6 +754,8 @@ GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
||||||
// we need the refresh tree animation to happen, so set the result directly
|
// we need the refresh tree animation to happen, so set the result directly
|
||||||
// instead of throwing
|
// instead of throwing
|
||||||
this.command.setResult('Fast-forwarding...');
|
this.command.setResult('Fast-forwarding...');
|
||||||
|
|
||||||
|
this.checkout(currentLocation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,6 +853,7 @@ GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
||||||
|
|
||||||
// now we just need to update the rebased branch is
|
// now we just need to update the rebased branch is
|
||||||
this.setLocationTarget(currentLocation, base);
|
this.setLocationTarget(currentLocation, base);
|
||||||
|
this.checkout(currentLocation);
|
||||||
// for animation
|
// for animation
|
||||||
return animationResponse;
|
return animationResponse;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue