diff --git a/package.json b/package.json index fbb061d..3259d64 100644 --- a/package.json +++ b/package.json @@ -60,4 +60,4 @@ "url": "https://github.com/Romakita/gflow/issues" }, "homepage": "https://github.com/Romakita/gflow" -} \ No newline at end of file +} diff --git a/src/git/index.js b/src/git/index.js index e79c65a..2c0a7d5 100644 --- a/src/git/index.js +++ b/src/git/index.js @@ -281,14 +281,19 @@ module.exports = { return module.exports .branches(...args) .map(branch => { - const [date, creation, author] = module.exports.show(branch).split('|'); - return { - branch, - date, - creation, - author - }; + try { + const [date, creation, author] = module.exports.show(branch).split('|'); + return { + branch, + date, + creation, + author + }; + } catch (er) { + return undefined; + } }) + .filter((b) => !!b) .sort((info1, info2) => info1.date < info2.date); }, diff --git a/src/utils/normalize-branch.js b/src/utils/normalize-branch.js index dba0e76..341c78b 100644 --- a/src/utils/normalize-branch.js +++ b/src/utils/normalize-branch.js @@ -2,7 +2,7 @@ const config = require('../config'); module.exports = { normalizeBranchName({ fromBranch, branchName, type }) { - const paths = [type || config.branchTypes.default, branchName.replace(/[- _/]/gi, config.charReplacement)]; + const paths = [config.branchTypes[type] || config.branchTypes.default, branchName.replace(/[- _/]/gi, config.charReplacement)]; fromBranch = fromBranch.replace(`${config.remote}/`, '');