threadlines 0.1.10 → 0.1.11
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/git/repo.js +6 -30
- package/package.json +1 -1
package/dist/git/repo.js
CHANGED
|
@@ -7,46 +7,22 @@ exports.getRepoName = getRepoName;
|
|
|
7
7
|
exports.getBranchName = getBranchName;
|
|
8
8
|
const simple_git_1 = __importDefault(require("simple-git"));
|
|
9
9
|
/**
|
|
10
|
-
* Gets
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Gets the raw git remote URL from origin.
|
|
11
|
+
* Returns the URL exactly as Git provides it - no parsing or normalization.
|
|
12
|
+
* Server-side can normalize variations if needed based on actual data.
|
|
13
13
|
*/
|
|
14
14
|
async function getRepoName(repoRoot) {
|
|
15
15
|
const git = (0, simple_git_1.default)(repoRoot);
|
|
16
16
|
try {
|
|
17
17
|
const remotes = await git.getRemotes(true);
|
|
18
18
|
const origin = remotes.find(r => r.name === 'origin');
|
|
19
|
-
if (!origin) {
|
|
20
|
-
console.log(' [DEBUG] No origin remote found');
|
|
19
|
+
if (!origin || !origin.refs?.fetch) {
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
23
|
-
if
|
|
24
|
-
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
const url = origin.refs.fetch;
|
|
28
|
-
console.log(` [DEBUG] Git remote URL: ${url}`);
|
|
29
|
-
// Parse repo name from common URL formats:
|
|
30
|
-
// - https://github.com/user/repo.git
|
|
31
|
-
// - git@github.com:user/repo.git
|
|
32
|
-
// - https://gitlab.com/user/repo.git
|
|
33
|
-
// - git@gitlab.com:user/repo.git
|
|
34
|
-
const patterns = [
|
|
35
|
-
/(?:github\.com|gitlab\.com)[\/:]([^\/]+\/[^\/]+?)(?:\.git)?$/,
|
|
36
|
-
/([^\/]+\/[^\/]+?)(?:\.git)?$/
|
|
37
|
-
];
|
|
38
|
-
for (const pattern of patterns) {
|
|
39
|
-
const match = url.match(pattern);
|
|
40
|
-
if (match && match[1]) {
|
|
41
|
-
console.log(` [DEBUG] Matched repo name: ${match[1]}`);
|
|
42
|
-
return match[1];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
console.log(' [DEBUG] No pattern matched the remote URL');
|
|
46
|
-
return null;
|
|
22
|
+
// Return raw URL - let server handle normalization if needed
|
|
23
|
+
return origin.refs.fetch;
|
|
47
24
|
}
|
|
48
25
|
catch (error) {
|
|
49
|
-
console.log(` [DEBUG] Error getting repo name: ${error.message}`);
|
|
50
26
|
return null;
|
|
51
27
|
}
|
|
52
28
|
}
|