git-watchtower 1.9.0 → 1.9.2
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 +7 -7
- package/package.json +1 -1
- package/src/git/branch.js +13 -6
package/bin/git-watchtower.js
CHANGED
|
@@ -993,11 +993,11 @@ async function refreshAllSparklines() {
|
|
|
993
993
|
return; // Don't refresh too often
|
|
994
994
|
}
|
|
995
995
|
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
if (branch.isDeleted) continue;
|
|
996
|
+
const currentBranches = store.get('branches');
|
|
997
|
+
for (const branch of currentBranches.slice(0, 20)) { // Limit to top 20
|
|
998
|
+
if (branch.isDeleted) continue;
|
|
1000
999
|
|
|
1000
|
+
try {
|
|
1001
1001
|
// Get commit counts for last 7 days (try remote, fall back to local)
|
|
1002
1002
|
const sparkResult = await execGitSilent(
|
|
1003
1003
|
['log', `origin/${branch.name}`, '--since=7 days ago', '--format=%ad', '--date=format:%Y-%m-%d'],
|
|
@@ -1027,11 +1027,11 @@ async function refreshAllSparklines() {
|
|
|
1027
1027
|
|
|
1028
1028
|
const counts = Array.from(dayCounts.values());
|
|
1029
1029
|
store.get('sparklineCache').set(branch.name, generateSparkline(counts));
|
|
1030
|
+
} catch (e) {
|
|
1031
|
+
// Skip this branch - don't let one failure abort all sparkline updates
|
|
1030
1032
|
}
|
|
1031
|
-
lastSparklineUpdate = now;
|
|
1032
|
-
} catch (e) {
|
|
1033
|
-
// Silently fail - sparklines are optional
|
|
1034
1033
|
}
|
|
1034
|
+
lastSparklineUpdate = now;
|
|
1035
1035
|
}
|
|
1036
1036
|
|
|
1037
1037
|
async function getPreviewData(branchName) {
|
package/package.json
CHANGED
package/src/git/branch.js
CHANGED
|
@@ -98,14 +98,17 @@ async function getAllBranches(options = {}) {
|
|
|
98
98
|
const seenBranches = new Set();
|
|
99
99
|
|
|
100
100
|
// Get local branches
|
|
101
|
+
// Use \x1f (Unit Separator) as delimiter since | can appear in commit subjects
|
|
102
|
+
const delimiter = '\x1f';
|
|
101
103
|
const localResult = await execGitSilent(
|
|
102
|
-
['for-each-ref', '--sort=-committerdate',
|
|
104
|
+
['for-each-ref', '--sort=-committerdate', `--format=%(refname:short)${delimiter}%(committerdate:iso8601)${delimiter}%(objectname:short)${delimiter}%(subject)`, 'refs/heads/'],
|
|
103
105
|
{ cwd }
|
|
104
106
|
);
|
|
105
107
|
|
|
106
108
|
if (localResult) {
|
|
107
109
|
for (const line of localResult.stdout.split('\n').filter(Boolean)) {
|
|
108
|
-
const [name, dateStr, commit,
|
|
110
|
+
const [name, dateStr, commit, ...subjectParts] = line.split(delimiter);
|
|
111
|
+
const subject = subjectParts.join(delimiter);
|
|
109
112
|
if (!seenBranches.has(name) && isValidBranchName(name)) {
|
|
110
113
|
seenBranches.add(name);
|
|
111
114
|
branchList.push({
|
|
@@ -123,14 +126,15 @@ async function getAllBranches(options = {}) {
|
|
|
123
126
|
|
|
124
127
|
// Get remote branches
|
|
125
128
|
const remoteResult = await execGitSilent(
|
|
126
|
-
['for-each-ref', '--sort=-committerdate',
|
|
129
|
+
['for-each-ref', '--sort=-committerdate', `--format=%(refname:short)${delimiter}%(committerdate:iso8601)${delimiter}%(objectname:short)${delimiter}%(subject)`, `refs/remotes/${remoteName}/`],
|
|
127
130
|
{ cwd }
|
|
128
131
|
);
|
|
129
132
|
|
|
130
133
|
if (remoteResult) {
|
|
131
134
|
const remotePrefix = `${remoteName}/`;
|
|
132
135
|
for (const line of remoteResult.stdout.split('\n').filter(Boolean)) {
|
|
133
|
-
const [fullName, dateStr, commit,
|
|
136
|
+
const [fullName, dateStr, commit, ...subjectParts] = line.split(delimiter);
|
|
137
|
+
const subject = subjectParts.join(delimiter);
|
|
134
138
|
const name = fullName.replace(remotePrefix, '');
|
|
135
139
|
|
|
136
140
|
if (name === 'HEAD') continue;
|
|
@@ -265,9 +269,10 @@ async function getPreviewData(branchName, options = {}) {
|
|
|
265
269
|
const safeName = sanitizeBranchName(branchName);
|
|
266
270
|
|
|
267
271
|
// Get recent commits
|
|
272
|
+
// Use %x1f (Unit Separator) as delimiter since | can appear in commit subjects
|
|
268
273
|
const commitLog = await log(safeName, {
|
|
269
274
|
count: commitCount,
|
|
270
|
-
format: '%h
|
|
275
|
+
format: '%h%x1f%s%x1f%cr',
|
|
271
276
|
cwd,
|
|
272
277
|
});
|
|
273
278
|
|
|
@@ -275,7 +280,9 @@ async function getPreviewData(branchName, options = {}) {
|
|
|
275
280
|
.split('\n')
|
|
276
281
|
.filter(Boolean)
|
|
277
282
|
.map((line) => {
|
|
278
|
-
const [hash,
|
|
283
|
+
const [hash, ...rest] = line.split('\x1f');
|
|
284
|
+
const time = rest.pop() || '';
|
|
285
|
+
const subject = rest.join('\x1f');
|
|
279
286
|
return { hash, subject, time };
|
|
280
287
|
});
|
|
281
288
|
|