threadlines 0.1.9 → 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 -22
- package/package.json +1 -1
package/dist/git/repo.js
CHANGED
|
@@ -7,38 +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
|
|
19
|
+
if (!origin || !origin.refs?.fetch) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// - https://github.com/user/repo.git
|
|
25
|
-
// - git@github.com:user/repo.git
|
|
26
|
-
// - https://gitlab.com/user/repo.git
|
|
27
|
-
// - git@gitlab.com:user/repo.git
|
|
28
|
-
const patterns = [
|
|
29
|
-
/(?:github\.com|gitlab\.com)[\/:]([^\/]+\/[^\/]+?)(?:\.git)?$/,
|
|
30
|
-
/([^\/]+\/[^\/]+?)(?:\.git)?$/
|
|
31
|
-
];
|
|
32
|
-
for (const pattern of patterns) {
|
|
33
|
-
const match = url.match(pattern);
|
|
34
|
-
if (match && match[1]) {
|
|
35
|
-
return match[1];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return null;
|
|
22
|
+
// Return raw URL - let server handle normalization if needed
|
|
23
|
+
return origin.refs.fetch;
|
|
39
24
|
}
|
|
40
25
|
catch (error) {
|
|
41
|
-
// If no remote or error, return null
|
|
42
26
|
return null;
|
|
43
27
|
}
|
|
44
28
|
}
|