Skip to content

Commit e5c52da

Browse files
Cologlerbugthesystem
authored andcommitted
open by default remote without set branch (#67)
1 parent de67841 commit e5c52da

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/extension.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,22 @@ function getGitProviderLink(cb, fileFsPath, lines, pr) {
3737
// Check to see if the branch has a configured remote
3838
configuredBranch = config[`branch "${branch}"`];
3939

40-
if (!configuredBranch) {
40+
if (configuredBranch) {
41+
// Use the current branch's configured remote
42+
remoteName = configuredBranch.remote;
43+
rawUri = config[`remote "${remoteName}"`].url;
44+
} else {
45+
const remotes = Object.keys(config).filter(k => k.startsWith('remote '));
46+
if (remotes.length > 0) {
47+
rawUri = config[remotes[0]].url;
48+
}
49+
}
50+
51+
if (!rawUri) {
4152
Window.showWarningMessage(`No remote found on branch.`);
4253
return;
4354
}
4455

45-
// Use the current branch's configured remote
46-
remoteName = configuredBranch.remote;
47-
rawUri = config[`remote "${remoteName}"`].url;
48-
4956
try {
5057
provider = gitProvider(rawUri);
5158
} catch (e) {

0 commit comments

Comments
 (0)