mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 15:38:33 +02:00
Resolves #132 -- checking out remote branches sets tracking
This commit is contained in:
parent
c2cab4c12a
commit
b2321dd265
7 changed files with 62 additions and 9 deletions
|
@ -548,7 +548,7 @@ GitEngine.prototype.validateAndMakeBranch = function(id, target) {
|
|||
});
|
||||
}
|
||||
|
||||
this.makeBranch(id, target);
|
||||
return this.makeBranch(id, target);
|
||||
};
|
||||
|
||||
GitEngine.prototype.makeBranch = function(id, target) {
|
||||
|
@ -2132,7 +2132,20 @@ GitEngine.prototype.forceBranch = function(branchName, where) {
|
|||
|
||||
GitEngine.prototype.branch = function(name, ref) {
|
||||
var target = this.getCommitFromRef(ref);
|
||||
this.validateAndMakeBranch(name, target);
|
||||
var newBranch = this.validateAndMakeBranch(name, target);
|
||||
|
||||
ref = this.resolveID(ref);
|
||||
if (this.isRemoteBranchRef(ref)) {
|
||||
this.setLocalToTrackRemote(newBranch, ref);
|
||||
}
|
||||
};
|
||||
|
||||
GitEngine.prototype.isRemoteBranchRef = function(ref) {
|
||||
var resolved = this.resolveID(ref);
|
||||
if (resolved.get('type') !== 'branch') {
|
||||
return false;
|
||||
}
|
||||
return resolved.getIsRemote();
|
||||
};
|
||||
|
||||
GitEngine.prototype.deleteBranch = function(name) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue