Skip to content

Commit fa6c858

Browse files
committed
Change Repository.prototype.setHead to be asynchronous
Changes the descriptor file to convert setHead to be asynchronous and return an error code. Also modifies the createBranch method to waterfall promises from setHead into Checkout.head.
1 parent 3ff031d commit fa6c858

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

generate/input/descriptor.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,12 @@
14631463
},
14641464
"git_repository_message": {
14651465
"ignore": true
1466+
},
1467+
"git_repository_set_head": {
1468+
"isAsync": true,
1469+
"return": {
1470+
"isErrorCode": true
1471+
}
14661472
}
14671473
}
14681474
},

lib/repository.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,11 @@ Repository.prototype.checkoutBranch = function(branch, opts) {
807807

808808
var name = ref.name();
809809

810-
repo.setHead(name, repo.defaultSignature(), "Switch HEAD to " + name);
811-
810+
return repo.setHead(name,
811+
repo.defaultSignature(),
812+
"Switch HEAD to " + name);
813+
})
814+
.then(function() {
812815
return Checkout.head(repo, opts);
813816
});
814817
};

0 commit comments

Comments
 (0)