fix: 修复获取上一个标签的逻辑以确保正确处理当前标签

This commit is contained in:
VirtualHotBar
2026-03-03 23:49:43 +08:00
parent d53ba7fc99
commit be8affb158

View File

@@ -57,7 +57,10 @@ try {
console.warn(`Tag ${currentTag} not found locally. Using HEAD as end of range.`);
}
const prevTag = tags.find((t) => t !== currentTag) || '';
const currentTagIndex = tags.indexOf(currentTag);
const prevTag = tagExists
? (currentTagIndex >= 0 ? tags[currentTagIndex + 1] || '' : '')
: tags[0] || '';
const endRef = tagExists ? currentTag : 'HEAD';
const range = prevTag ? `${prevTag}..${endRef}` : endRef;