mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 16:38:50 +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() {
|
||||
if (this.getDetachedHead()) {
|
||||
throw new GitError({
|
||||
msg: "No rebasing in detached head!"
|
||||
});
|
||||
}
|
||||
|
||||
if (this.generalArgs.length > 2) {
|
||||
throw new GitError({
|
||||
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!'
|
||||
});
|
||||
}
|
||||
|
||||
if (this.generalArgs.length == 1) {
|
||||
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]);
|
||||
|
||||
if (response === undefined) {
|
||||
|
@ -856,6 +858,11 @@ GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
|||
// now we just need to update where we are
|
||||
this.setLocationTarget(currentLocation, base);
|
||||
|
||||
// if we are in detached head, update that too
|
||||
if (this.getDetachedHead()) {
|
||||
this.setLocationTarget(this.HEAD, base);
|
||||
}
|
||||
|
||||
// for animation
|
||||
return animationResponse;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue