FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Replace fse.existsSync with a catch on fse.readFile · nodegit/nodegit@62daba3 · GitHub

Repository navigation

Commit 62daba3

Browse files
Carson Howard
committed
Replace fse.existsSync with a catch on fse.readFile
1 parent 1c334c6 commit 62daba3

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

‎lib/repository.js‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,18 @@ function performRebase(
207207
/* In the case of FF merges and a beforeFinishFn, this will fail
208208
* when looking for 'rewritten' so we need to handle that case.
209209
*/
210-
function readRebaseMetadataFile(fileName, determineExistance) {
211-
const fullPath = path.join(repository.path(), "rebase-merge", fileName);
212-
if (determineExistance && !fse.existsSync(fullPath)) {
213-
return Promise.resolve(null);
214-
}
215-
210+
function readRebaseMetadataFile(fileName, continueOnError) {
216211
return fse.readFile(
217-
fullPath,
212+
path.join(repository.path(), "rebase-merge", fileName),
218213
{ encoding: "utf8" }
219214
)
220-
.then(fp.trim);
215+
.then(fp.trim)
216+
.catch(function(err) {
217+
if (continueOnError) {
218+
return null;
219+
}
220+
throw err;
221+
});
221222
}
222223

223224
function calcHeadName(input) {

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL