feat(git): Added remote url type option (#146124)

* feat(git): Added remote url type option

* Modify extension configuration

* Simplified code

Co-authored-by: Joao Moreno <joao.moreno@microsoft.com>
This commit is contained in:
zz
2022-04-05 21:49:50 +08:00
committed by GitHub
parent 80f8b99e3c
commit a8097b5607
6 changed files with 19 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { workspace } from 'vscode';
import { RemoteSourceProvider, RemoteSource } from './typings/git-base';
import { getOctokit } from './auth';
import { Octokit } from '@octokit/rest';
@@ -14,10 +15,11 @@ function parse(url: string): { owner: string; repo: string } | undefined {
}
function asRemoteSource(raw: any): RemoteSource {
const protocol = workspace.getConfiguration('github').get<'https' | 'ssh'>('gitProtocol');
return {
name: `$(github) ${raw.full_name}`,
description: raw.description || undefined,
url: raw.clone_url
url: protocol === 'https' ? raw.clone_url : raw.ssh_url
};
}