From 8083f33c9e4659d1122cecdab19fa0b3f8625532 Mon Sep 17 00:00:00 2001 From: Steven King Jr Date: Fri, 1 Feb 2019 12:40:27 -0700 Subject: [PATCH 1/2] Add a `rebaseOptions` parameter to `Repository.prototype.continueRebase` --- lib/repository.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/repository.js b/lib/repository.js index 77ba9d116..91422df97 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -455,13 +455,16 @@ Repository.prototype.checkoutRef = function(reference, opts) { * promise, finish() will be called when the * promise resolves. This callback will be * provided a detailed overview of the rebase + * @param {RebaseOptions} rebaseOptions Options to initialize the rebase object + * with * @return {Oid|Index} A commit id for a succesful merge or an index for a * rebase with conflicts */ Repository.prototype.continueRebase = function( signature, beforeNextFn, - beforeFinishFn + beforeFinishFn, + rebaseOptions ) { var repo = this; @@ -474,7 +477,7 @@ Repository.prototype.continueRebase = function( throw index; } - return NodeGit.Rebase.open(repo); + return NodeGit.Rebase.open(repo, rebaseOptions); }) .then(function(_rebase) { rebase = _rebase; @@ -1505,6 +1508,8 @@ Repository.prototype.isReverting = function() { * promise, finish() will be called when the * promise resolves. This callback will be * provided a detailed overview of the rebase + * @param {RebaseOptions} rebaseOptions Options to initialize the rebase object + * with * @return {Oid|Index} A commit id for a succesful merge or an index for a * rebase with conflicts */ From 74e7c1e89ab21801ca6ee13443ef813c05e04b93 Mon Sep 17 00:00:00 2001 From: Steven King Jr Date: Fri, 1 Feb 2019 12:44:28 -0700 Subject: [PATCH 2/2] Only swallow EAPPLIED errors in `Repository.prototype.continueRebase` One example of a meaningful exception occurring in `continueRebase` is for the signing callback to throw because of an invalid key passphrase. In such chases, errors should not be swallowed. In #1348, EAPPLIED was mentioned specifically as en error that we would like to swallow. --- lib/repository.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/repository.js b/lib/repository.js index 91422df97..3636c9a6e 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -482,11 +482,17 @@ Repository.prototype.continueRebase = function( .then(function(_rebase) { rebase = _rebase; return rebase.commit(null, signature) - .catch(function() { + .catch(function(e) { // Ignore all errors to prevent // this routine from choking now // that we made rebase.commit // asynchronous + const errorno = fp.get(["errorno"], e); + if (errorno === NodeGit.Error.CODE.EAPPLIED) { + return; + } + + throw e; }); }) .then(function() {