@handsupmin/gc-tree 0.7.4 → 0.7.5
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/src/repo-map.js +6 -3
- package/package.json +1 -1
package/dist/src/repo-map.js
CHANGED
|
@@ -73,13 +73,16 @@ export async function detectCurrentRepoId(startDir = process.cwd()) {
|
|
|
73
73
|
const root = await detectRepoRoot(startDir);
|
|
74
74
|
return root ? basename(root) : null;
|
|
75
75
|
}
|
|
76
|
+
function repoMatches(entry, repo) {
|
|
77
|
+
return entry === repo || basename(entry) === repo || entry === basename(repo);
|
|
78
|
+
}
|
|
76
79
|
export function branchScopeStatus(mapping, branch, repo) {
|
|
77
80
|
if (!repo)
|
|
78
81
|
return 'unscoped';
|
|
79
82
|
const rule = normalizeRule(mapping[branch]);
|
|
80
|
-
if (rule.exclude?.
|
|
83
|
+
if (rule.exclude?.some((e) => repoMatches(e, repo)))
|
|
81
84
|
return 'excluded';
|
|
82
|
-
if (rule.include?.
|
|
85
|
+
if (rule.include?.some((e) => repoMatches(e, repo)))
|
|
83
86
|
return 'included';
|
|
84
87
|
if ((rule.include?.length || 0) > 0 || (rule.exclude?.length || 0) > 0)
|
|
85
88
|
return 'unmapped';
|
|
@@ -98,7 +101,7 @@ export async function resolveBranchForRepo({ home, head, explicitBranch, cwd = p
|
|
|
98
101
|
}
|
|
99
102
|
if (currentRepo) {
|
|
100
103
|
const includedBranches = Object.entries(mapping)
|
|
101
|
-
.filter(([, rule]) => !rule.exclude?.
|
|
104
|
+
.filter(([, rule]) => !rule.exclude?.some((e) => repoMatches(e, currentRepo)) && rule.include?.some((e) => repoMatches(e, currentRepo)))
|
|
102
105
|
.map(([branch]) => branch)
|
|
103
106
|
.sort();
|
|
104
107
|
if (includedBranches.length === 1) {
|