Attempts to fix #58 - work with sub-modules

Also fixes issue with nested repos
This commit is contained in:
Eric Amodio
2017-04-01 00:58:09 -04:00
parent 7ce5a396a1
commit d3af67b21b
21 changed files with 38 additions and 25 deletions

View File

@@ -17,9 +17,11 @@ export class OpenCommitInRemoteCommand extends ActiveEditorCommand {
uri = editor.document.uri;
}
if (editor && editor.document && editor.document.isDirty) return undefined;
if ((editor && editor.document && editor.document.isDirty) || uri) return undefined;
const gitUri = await GitUri.fromUri(uri, this.git);
if (!gitUri.repoPath) return undefined;
const line = (editor && editor.selection.active.line) || gitUri.offset;
try {
@@ -35,7 +37,7 @@ export class OpenCommitInRemoteCommand extends ActiveEditorCommand {
commit = new GitCommit(commit.type, commit.repoPath, commit.previousSha, commit.previousFileName, commit.author, commit.date, commit.message);
}
const remotes = Arrays.uniqueBy(await this.git.getRemotes(this.git.repoPath), _ => _.url, _ => !!_.provider);
const remotes = Arrays.uniqueBy(await this.git.getRemotes(gitUri.repoPath), _ => _.url, _ => !!_.provider);
return commands.executeCommand(Commands.OpenInRemote, uri, remotes, 'commit', [commit.sha]);
}
catch (ex) {