Skip to content

Commit a9553e0

Browse files
committed
Merge pull request nodegit#469 from jrbalsano/master
Change Repository.prototype.setHead to be asynchronous
2 parents 3ff031d + fa6c858 commit a9553e0

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)