Resolves #132 -- checking out remote branches sets tracking

This commit is contained in:
Peter Cottle 2013-10-09 21:28:40 -07:00
parent c2cab4c12a
commit b2321dd265
7 changed files with 62 additions and 9 deletions

View file

@ -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) {