From fa6c858893c6da4b431b5b0b3d95494861326c8e Mon Sep 17 00:00:00 2001 From: Jonathan Balsano Date: Thu, 5 Mar 2015 18:26:16 -0500 Subject: [PATCH] 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. --- generate/input/descriptor.json | 6 ++++++ lib/repository.js | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/generate/input/descriptor.json b/generate/input/descriptor.json index 259faacd2..bb3b4514d 100644 --- a/generate/input/descriptor.json +++ b/generate/input/descriptor.json @@ -1463,6 +1463,12 @@ }, "git_repository_message": { "ignore": true + }, + "git_repository_set_head": { + "isAsync": true, + "return": { + "isErrorCode": true + } } } }, diff --git a/lib/repository.js b/lib/repository.js index 349e655b2..7d9b61990 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -807,8 +807,11 @@ Repository.prototype.checkoutBranch = function(branch, opts) { var name = ref.name(); - repo.setHead(name, repo.defaultSignature(), "Switch HEAD to " + name); - + return repo.setHead(name, + repo.defaultSignature(), + "Switch HEAD to " + name); + }) + .then(function() { return Checkout.head(repo, opts); }); };