git-watchtower 1.9.8 → 1.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/git-watchtower.js +13 -2
- package/package.json +1 -1
package/bin/git-watchtower.js
CHANGED
|
@@ -1669,6 +1669,7 @@ async function pollGitChanges() {
|
|
|
1669
1669
|
const currentBranches = store.get('branches');
|
|
1670
1670
|
|
|
1671
1671
|
// Detect NEW branches (not seen before)
|
|
1672
|
+
const NEW_BADGE_TTL = 30000; // 30 seconds
|
|
1672
1673
|
const newBranchList = [];
|
|
1673
1674
|
for (const branch of allBranches) {
|
|
1674
1675
|
if (!knownBranchNames.has(branch.name)) {
|
|
@@ -1677,9 +1678,9 @@ async function pollGitChanges() {
|
|
|
1677
1678
|
addLog(`New branch: ${branch.name}`, 'success');
|
|
1678
1679
|
newBranchList.push(branch);
|
|
1679
1680
|
} else {
|
|
1680
|
-
// Preserve isNew flag from previous poll cycle
|
|
1681
|
+
// Preserve isNew flag from previous poll cycle, but expire after TTL
|
|
1681
1682
|
const prevBranch = currentBranches.find(b => b.name === branch.name);
|
|
1682
|
-
if (prevBranch && prevBranch.isNew) {
|
|
1683
|
+
if (prevBranch && prevBranch.isNew && (now - prevBranch.newAt) < NEW_BADGE_TTL) {
|
|
1683
1684
|
branch.isNew = true;
|
|
1684
1685
|
branch.newAt = prevBranch.newAt;
|
|
1685
1686
|
}
|
|
@@ -1727,10 +1728,12 @@ async function pollGitChanges() {
|
|
|
1727
1728
|
// Detect updates on other branches (for flash notification)
|
|
1728
1729
|
const updatedBranches = [];
|
|
1729
1730
|
const currentBranchName = store.get('currentBranch');
|
|
1731
|
+
const activeBranchNames = new Set();
|
|
1730
1732
|
for (const branch of pollFilteredBranches) {
|
|
1731
1733
|
// Clear previous cycle's flag so only freshly-updated branches are highlighted
|
|
1732
1734
|
branch.justUpdated = false;
|
|
1733
1735
|
if (branch.isDeleted) continue;
|
|
1736
|
+
activeBranchNames.add(branch.name);
|
|
1734
1737
|
const prevCommit = previousBranchStates.get(branch.name);
|
|
1735
1738
|
if (prevCommit && prevCommit !== branch.commit && branch.name !== currentBranchName) {
|
|
1736
1739
|
updatedBranches.push(branch);
|
|
@@ -1739,6 +1742,14 @@ async function pollGitChanges() {
|
|
|
1739
1742
|
previousBranchStates.set(branch.name, branch.commit);
|
|
1740
1743
|
}
|
|
1741
1744
|
|
|
1745
|
+
// Remove stale entries from previousBranchStates for branches
|
|
1746
|
+
// that no longer exist in the current poll results
|
|
1747
|
+
for (const name of previousBranchStates.keys()) {
|
|
1748
|
+
if (!activeBranchNames.has(name)) {
|
|
1749
|
+
previousBranchStates.delete(name);
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1742
1753
|
// Flash and sound for updates or new branches
|
|
1743
1754
|
const casinoOn = store.get('casinoModeEnabled');
|
|
1744
1755
|
const notifyBranches = [...updatedBranches, ...newBranchList];
|
package/package.json
CHANGED