Skip to content

Commit 6e4bd2d

Browse files
Fix: gracefully handle shorthashes longer than 7 characters (fixes #15) (#16)
1 parent e528c95 commit 6e4bd2d

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

lib/release-ops.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ function getVersionTags() {
175175
* @private
176176
*/
177177
function parseLogs(logs) {
178-
var regexp = /^(?:\* )?([0-9a-f]{7}) ((?:([a-z]+): ?)?.*) \((.*)\)/i,
178+
var regexp = /^(?:\* )?([0-9a-f]{7,}) ((?:([a-z]+): ?)?.*) \((.*)\)/i,
179179
parsed = [];
180180

181181
logs.forEach(function(log) {

tests/lib/release-ops.js

+23
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,29 @@ describe("ReleaseOps", function() {
249249
});
250250
});
251251

252+
// https://github.com/eslint/eslint-release/issues/15
253+
it("should gracefully handle commit shorthashes longer than 7 characters", function() {
254+
var logs = [
255+
"* 6b498edabcde Build: package.json and changelog update for 0.4.0-alpha.4 (Nicholas C. Zakas)",
256+
"* 2578f31000 Fix: Changelog output (Nicholas C. Zakas)"
257+
],
258+
releaseInfo = ReleaseOps.calculateReleaseFromGitLogs("0.4.0-alpha.4", logs, "alpha");
259+
260+
assert.deepEqual(releaseInfo, {
261+
version: "0.4.0-alpha.5",
262+
type: "patch",
263+
changelog: {
264+
build: [
265+
"* 6b498edabcde Build: package.json and changelog update for 0.4.0-alpha.4 (Nicholas C. Zakas)"
266+
],
267+
fix: [
268+
"* 2578f31000 Fix: Changelog output (Nicholas C. Zakas)"
269+
]
270+
},
271+
rawChangelog: logs.join("\n")
272+
});
273+
});
274+
252275
});
253276

254277
});

0 commit comments

Comments
 (0)