mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-20 21:35:42 +02:00
Merge pull request #1247 from pcottle/attempt1245
Some checks failed
Docker - learnGitBranching image / build-and-push-image (push) Has been cancelled
Some checks failed
Docker - learnGitBranching image / build-and-push-image (push) Has been cancelled
My attempt at #1245
This commit is contained in:
commit
4dc4d0e08d
1 changed files with 23 additions and 8 deletions
|
@ -2412,6 +2412,15 @@ GitEngine.prototype.rebaseFinish = function(
|
||||||
var destinationBranch = this.resolveID(targetSource);
|
var destinationBranch = this.resolveID(targetSource);
|
||||||
var deferred = options.deferred || Q.defer();
|
var deferred = options.deferred || Q.defer();
|
||||||
var chain = options.chain || deferred.promise;
|
var chain = options.chain || deferred.promise;
|
||||||
|
var originalCurrentLocationToUpdate = null;
|
||||||
|
if (this.getType(currentLocation) == 'commit') {
|
||||||
|
// We will just be updating HEAD so no need to store
|
||||||
|
// anything
|
||||||
|
} else {
|
||||||
|
// This is the source branch we are coming off of, so we need
|
||||||
|
// to update this bad boy after the animation
|
||||||
|
originalCurrentLocationToUpdate = this.getOneBeforeCommit(currentLocation);
|
||||||
|
}
|
||||||
|
|
||||||
var toRebase = this.filterRebaseCommits(toRebaseRough, stopSet, options);
|
var toRebase = this.filterRebaseCommits(toRebaseRough, stopSet, options);
|
||||||
if (!toRebase.length) {
|
if (!toRebase.length) {
|
||||||
|
@ -2426,6 +2435,13 @@ GitEngine.prototype.rebaseFinish = function(
|
||||||
destinationBranch
|
destinationBranch
|
||||||
);
|
);
|
||||||
|
|
||||||
|
chain = chain.then(function() {
|
||||||
|
// Animate our current location to the base to aid
|
||||||
|
// in visual learning
|
||||||
|
this.checkout(this.getCommitFromRef(targetSource));
|
||||||
|
return this.animationFactory.playRefreshAnimation(this.gitVisuals);
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
// now pop all of these commits onto targetLocation
|
// now pop all of these commits onto targetLocation
|
||||||
var base = this.getCommitFromRef(targetSource);
|
var base = this.getCommitFromRef(targetSource);
|
||||||
var hasStartedChain = false;
|
var hasStartedChain = false;
|
||||||
|
@ -2461,15 +2477,14 @@ GitEngine.prototype.rebaseFinish = function(
|
||||||
});
|
});
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
// now base will be the last commit in the chain, so we need to set the
|
||||||
|
// source to that commit
|
||||||
chain = chain.then(function() {
|
chain = chain.then(function() {
|
||||||
if (this.resolveID(currentLocation).get('type') == 'commit') {
|
if (originalCurrentLocationToUpdate) {
|
||||||
// we referenced a commit like git rebase C2 C1, so we have
|
this.setTargetLocation(originalCurrentLocationToUpdate, base);
|
||||||
// to manually check out C1'
|
this.checkout(originalCurrentLocationToUpdate);
|
||||||
this.checkout(base);
|
|
||||||
} else {
|
} else {
|
||||||
// now we just need to update the rebased branch is
|
this.checkout(base);
|
||||||
this.setTargetLocation(currentLocation, base);
|
|
||||||
this.checkout(currentLocation);
|
|
||||||
}
|
}
|
||||||
return this.animationFactory.playRefreshAnimation(this.gitVisuals);
|
return this.animationFactory.playRefreshAnimation(this.gitVisuals);
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
@ -2520,7 +2535,7 @@ GitEngine.prototype.merge = function(targetSource, options) {
|
||||||
// since we specify parent 1 as the first parent, it is the "main" parent
|
// since we specify parent 1 as the first parent, it is the "main" parent
|
||||||
// and the node will be displayed below that branch / commit / whatever
|
// and the node will be displayed below that branch / commit / whatever
|
||||||
var commitParents = [parent1];
|
var commitParents = [parent1];
|
||||||
|
|
||||||
if (!options.squash) {
|
if (!options.squash) {
|
||||||
// a squash commit doesn't include the reference to the second parent
|
// a squash commit doesn't include the reference to the second parent
|
||||||
commitParents.push(parent2);
|
commitParents.push(parent2);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue