mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-14 00:24:28 +02:00
rebase detached head thing
This commit is contained in:
parent
85de7c5a04
commit
85b66e83bd
1 changed files with 13 additions and 6 deletions
19
src/git.js
19
src/git.js
|
@ -708,12 +708,6 @@ GitEngine.prototype.idSortFunc = function(cA, cB) {
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.rebaseStarter = function() {
|
GitEngine.prototype.rebaseStarter = function() {
|
||||||
if (this.getDetachedHead()) {
|
|
||||||
throw new GitError({
|
|
||||||
msg: "No rebasing in detached head!"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.generalArgs.length > 2) {
|
if (this.generalArgs.length > 2) {
|
||||||
throw new GitError({
|
throw new GitError({
|
||||||
msg: 'rebase with more than 2 arguments doesnt make sense!'
|
msg: 'rebase with more than 2 arguments doesnt make sense!'
|
||||||
|
@ -724,9 +718,17 @@ GitEngine.prototype.rebaseStarter = function() {
|
||||||
msg: 'Give me a branch to rebase onto!'
|
msg: 'Give me a branch to rebase onto!'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.generalArgs.length == 1) {
|
if (this.generalArgs.length == 1) {
|
||||||
this.generalArgs.push('HEAD');
|
this.generalArgs.push('HEAD');
|
||||||
|
if (this.getDetachedHead()) {
|
||||||
|
throw new GitError({
|
||||||
|
msg: "No rebasing in detached head when you are " +
|
||||||
|
"referring to HEAD by only passing in one argument!"
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var response = this.rebase(this.generalArgs[0], this.generalArgs[1]);
|
var response = this.rebase(this.generalArgs[0], this.generalArgs[1]);
|
||||||
|
|
||||||
if (response === undefined) {
|
if (response === undefined) {
|
||||||
|
@ -856,6 +858,11 @@ GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
||||||
// now we just need to update where we are
|
// now we just need to update where we are
|
||||||
this.setLocationTarget(currentLocation, base);
|
this.setLocationTarget(currentLocation, base);
|
||||||
|
|
||||||
|
// if we are in detached head, update that too
|
||||||
|
if (this.getDetachedHead()) {
|
||||||
|
this.setLocationTarget(this.HEAD, base);
|
||||||
|
}
|
||||||
|
|
||||||
// for animation
|
// for animation
|
||||||
return animationResponse;
|
return animationResponse;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue