Skip to content

Commit 7263516

Browse files
committed
fix: 当使用latest获取最近 logs 时,如果有合并分支,可能导致丢了某些 log 的问题(丢失特征:log的时间点比上一个tag还要旧)
1 parent ae7ccdf commit 7263516

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/getCommits.js

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

25-
if (index === tagCommitObjList.length - 1) {
26-
tagCommitObj.commits = tagCommitObj.commits.filter(isUnique);
27-
25+
if (index > tagCommitObjList.length - 1) {
2826
loopResolve();
2927
return;
3028
}
3129

32-
git.raw(['log', `${tagCommitObj.tag}...${tagCommitObj.previousTag}`, PrettyFormats.arg], (loopErr, loopResult) => {
30+
git.raw(['log', `${tagCommitObj.tag || ''}...${tagCommitObj.previousTag || ''}`, PrettyFormats.arg], (loopErr, loopResult) => {
3331
if (loopErr) throw loopErr;
3432

3533
const commits = PrettyFormats.parse(loopResult);
3634
let mergeCommits = tagCommitObj.commits.concat(commits);
3735

38-
spinner.text = `Loading logs between ${tagCommitObj.tag} and ${tagCommitObj.previousTag} , Progress: ${index + 1}/${tagCommitObjList.length - 1}`;
36+
spinner.text = `Loading logs between ${tagCommitObj.tag || ''} and ${tagCommitObj.previousTag || ''} , Progress: ${index + 1}/${tagCommitObjList.length - 1}`;
3937

4038
mergeCommits = mergeCommits
4139
.sort((commitA, commitB) => commitB.ct - commitA.ct)

0 commit comments

Comments
 (0)