Skip to content

Commit

Permalink
Fix: gracefully handle shorthashes longer than 7 characters (fixes #15)…
Browse files Browse the repository at this point in the history
… (#16)
  • Loading branch information
not-an-aardvark authored Apr 27, 2017
1 parent e528c95 commit 6e4bd2d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/release-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function getVersionTags() {
* @private
*/
function parseLogs(logs) {
var regexp = /^(?:\* )?([0-9a-f]{7}) ((?:([a-z]+): ?)?.*) \((.*)\)/i,
var regexp = /^(?:\* )?([0-9a-f]{7,}) ((?:([a-z]+): ?)?.*) \((.*)\)/i,
parsed = [];

logs.forEach(function(log) {
Expand Down
23 changes: 23 additions & 0 deletions tests/lib/release-ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,29 @@ describe("ReleaseOps", function() {
});
});

// https://github.com/eslint/eslint-release/issues/15
it("should gracefully handle commit shorthashes longer than 7 characters", function() {
var logs = [
"* 6b498edabcde Build: package.json and changelog update for 0.4.0-alpha.4 (Nicholas C. Zakas)",
"* 2578f31000 Fix: Changelog output (Nicholas C. Zakas)"
],
releaseInfo = ReleaseOps.calculateReleaseFromGitLogs("0.4.0-alpha.4", logs, "alpha");

assert.deepEqual(releaseInfo, {
version: "0.4.0-alpha.5",
type: "patch",
changelog: {
build: [
"* 6b498edabcde Build: package.json and changelog update for 0.4.0-alpha.4 (Nicholas C. Zakas)"
],
fix: [
"* 2578f31000 Fix: Changelog output (Nicholas C. Zakas)"
]
},
rawChangelog: logs.join("\n")
});
});

});

});

0 comments on commit 6e4bd2d

Please sign in to comment.