Skip to content

Commit 6882d99

Browse files
author
bearyan
committed
fix: 如果没有上一个tag,则不需要迭代了。因为迭代会出很多过往的log,但其实并不是这次查log中需要的
1 parent 6eedde8 commit 6882d99

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/getCommits.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,14 @@ function gitLogLoop(tagCommitObjList) {
2222
return new Promise(async (loopResolve) => {
2323
const tagCommitObj = tagCommitObjList[index];
2424

25-
if (index > tagCommitObjList.length - 1) {
25+
if (index >= tagCommitObjList.length || !tagCommitObj.previousTag) {
2626
loopResolve();
2727
return;
2828
}
2929

3030
let logSelection = '';
3131
if (tagCommitObj.previousTag) {
3232
logSelection = `${tagCommitObj.tag || ''}...${tagCommitObj.previousTag}`;
33-
} else {
34-
logSelection = `${tagCommitObj.tag || ''}...${tagCommitObj.commits[tagCommitObj.commits.length - 1].H}`;
3533
}
3634

3735
git.raw(['log', logSelection, PrettyFormats.arg], (loopErr, loopResult) => {

0 commit comments

Comments
 (0)