@harryisfish/gitt 1.6.2 → 1.6.4
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/dist/commands/clean.js +6 -1
- package/dist/index.js +3 -2
- package/package.json +2 -2
package/dist/commands/clean.js
CHANGED
|
@@ -58,9 +58,14 @@ async function cleanDeletedBranches(options = {}) {
|
|
|
58
58
|
}
|
|
59
59
|
else {
|
|
60
60
|
// Default mode: check "gone" branches
|
|
61
|
+
// Note: label may contain newlines/whitespace when branch names are long
|
|
61
62
|
const goneBranches = branchSummary.all.filter(branch => {
|
|
62
63
|
const branchInfo = branchSummary.branches[branch];
|
|
63
|
-
|
|
64
|
+
if (!branchInfo.label)
|
|
65
|
+
return false;
|
|
66
|
+
// Normalize whitespace and check for "gone" status
|
|
67
|
+
const normalizedLabel = branchInfo.label.replace(/\s+/g, ' ');
|
|
68
|
+
return normalizedLabel.includes(': gone]');
|
|
64
69
|
});
|
|
65
70
|
candidates = goneBranches.map(b => ({ name: b, reason: 'Remote deleted' }));
|
|
66
71
|
}
|
package/dist/index.js
CHANGED
|
@@ -86,11 +86,12 @@ async function main() {
|
|
|
86
86
|
program
|
|
87
87
|
.option('-i, --interactive', 'Interactive mode: Select branches to delete')
|
|
88
88
|
.option('-d, --dry-run', 'Dry run: Show what would be deleted without deleting')
|
|
89
|
-
.option('--stale [days]', 'Find stale branches (default: 90 days)'
|
|
89
|
+
.option('--stale [days]', 'Find stale branches (default: 90 days)')
|
|
90
90
|
.action(async (options) => {
|
|
91
91
|
await checkGitRepo();
|
|
92
|
-
|
|
92
|
+
// options.stale is undefined when not passed, true when passed without value, or a string when passed with value
|
|
93
93
|
const isStale = options.stale !== undefined;
|
|
94
|
+
const staleDays = options.stale === true || options.stale === undefined ? 90 : parseInt(options.stale, 10);
|
|
94
95
|
await (0, clean_1.cleanDeletedBranches)({
|
|
95
96
|
interactive: options.interactive || false,
|
|
96
97
|
dryRun: options.dryRun || false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@harryisfish/gitt",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "A command-line tool to help you manage Git repositories and remote repositories, such as keeping in sync, pushing, pulling, etc.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -61,4 +61,4 @@
|
|
|
61
61
|
"README.md",
|
|
62
62
|
"LICENSE"
|
|
63
63
|
]
|
|
64
|
-
}
|
|
64
|
+
}
|