Skip to content

Commit 5901fc5

Browse files
committed
fix: use full commit hashes for links
1 parent a597d5d commit 5901fc5

6 files changed

Lines changed: 15 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## **2.6.3**&emsp;<sub><sup>2023-03-02 ([ad1d56c...a64d54f](https://github.com/qoomon/git-conventional-commits/compare/ad1d56c...a64d54f?diff=split))</sup></sub>
2+
3+
### Bug Fixes
4+
* use full commit hashes for links ([a64d54f](https://github.com/qoomon/git-conventional-commits/commit/a64d54f))
5+
6+
<br>
7+
18
## **2.6.0**&emsp;<sub><sup>2023-02-28 ([aafcc05...aafcc05](https://github.com/qoomon/git-conventional-commits/compare/aafcc05...aafcc05?diff=split))</sup></sub>
29

310
### Features

lib/changelogGenerator.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,9 @@ module.exports = function (config) {
227227

228228
function markdownCommitRange(formCommitHash, toCommitHash) {
229229
if (config.commitRangeUrl) {
230-
const commitRangeUrl = config.commitRangeUrl.replace("%from%", formCommitHash).replace("%to%",
231-
toCommitHash);
230+
const commitRangeUrl = config.commitRangeUrl
231+
.replace("%from%", formCommitHash)
232+
.replace("%to%", toCommitHash);
232233
return markdownLink(`${formCommitHash.substring(0, 7)}...${toCommitHash.substring(0, 7)}`, commitRangeUrl);
233234
}
234235

lib/git.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const LOG_COMMIT_DELIMITER = '===LOG_COMMIT_DELIMITER===';
2929
const LOG_FIELD_SEPARATOR = '===LOG_FIELD_SEPARATOR===';
3030

3131
async function getCommitLog(from, to = 'HEAD') {
32-
const gitLogFormat = ["%h", "%aI", "%s", "%b"].join(LOG_FIELD_SEPARATOR) + LOG_COMMIT_DELIMITER;
32+
const gitLogFormat = ["%H", "%aI", "%s", "%b"].join(LOG_FIELD_SEPARATOR) + LOG_COMMIT_DELIMITER;
3333
const gitLog = await execAsync(`git log --reverse --format=${gitLogFormat} ${from ? `${from}..` : ''}${to}`, {encoding: 'UTF-8'})
3434
.then(result => result.split(LOG_COMMIT_DELIMITER + '\n').slice(0, -1))
3535
.catch(err => {

lib/gitCommitConvention.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ module.exports = function (convention, commitAnchor = 'HEAD') {
102102
conventionalSubject = parseCommitSubject(conventionalSubject);
103103
conventionalSubject.revert = !conventionalSubject.revert; // negate revert of revert commit
104104
} else {
105-
console.warn(`[WARN] ${commit.hash ? `${commit.hash} - ` : ''}Invalid commit subject format: '${commit.subject}'`);
105+
console.warn(`[WARN] ${commit.hash ? `${commit.hash.substring(0, 7)} - ` : ''}Invalid commit subject format: '${commit.subject}'`);
106106
return conventionalSubject;
107107
}
108108
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "git-conventional-commits",
3-
"version": "2.6.2",
3+
"version": "2.6.3",
44
"description": "git conventional commits util",
55
"licence": "GPLv3",
66
"main": "cli.js",

0 commit comments

Comments
 (0)