Przeglądaj źródła

Fixes add remote & adds to remotes view

main
Eric Amodio 3 lat temu
rodzic
commit
579cd475c6
4 zmienionych plików z 24 dodań i 5 usunięć
  1. +5
    -0
      package.json
  2. +12
    -1
      src/commands/gitCommands.actions.ts
  3. +4
    -0
      src/views/nodes/remotesNode.ts
  4. +3
    -4
      src/views/viewCommands.ts

+ 5
- 0
package.json Wyświetl plik

@ -6359,6 +6359,11 @@
"group": "5_gitlens@0"
},
{
"command": "gitlens.views.addRemote",
"when": "!gitlens:readonly && view =~ /gitlens\\.views\\.remotes/",
"group": "navigation@1"
},
{
"command": "gitlens.views.remotes.setLayoutToList",
"when": "view =~ /gitlens\\.views\\.remotes/ && config.gitlens.views.remotes.branches.layout == tree",
"group": "navigation@50"

+ 12
- 1
src/commands/gitCommands.actions.ts Wyświetl plik

@ -27,6 +27,7 @@ import {
Repository,
} from '../git/git';
import { GitUri } from '../git/gitUri';
import { RepositoryPicker } from '../quickpicks';
import { ResetGitCommandArgs } from './git/reset';
export async function executeGitCommand(args: GitCommandsCommandArgs): Promise<void> {
@ -758,7 +759,17 @@ export namespace GitActions {
}
export namespace Remote {
export async function add(repo: string | Repository) {
export async function add(repo?: string | Repository) {
if (repo == null) {
repo = Container.git.getHighlanderRepoPath();
if (repo == null) {
const pick = await RepositoryPicker.show(undefined, 'Choose a repository to add a remote to');
repo = pick?.item;
if (repo == null) return undefined;
}
}
const name = await window.showInputBox({
prompt: 'Please provide a name for the remote',
placeHolder: 'Remote name',

+ 4
- 0
src/views/nodes/remotesNode.ts Wyświetl plik

@ -26,6 +26,10 @@ export class RemotesNode extends ViewNode {
return RemotesNode.getId(this.repo.path);
}
get repoPath(): string {
return this.repo.path;
}
async getChildren(): Promise<ViewNode[]> {
if (this._children == null) {
const remotes = await this.repo.getRemotes({ sort: true });

+ 3
- 4
src/views/viewCommands.ts Wyświetl plik

@ -33,6 +33,7 @@ import {
PagerNode,
PullRequestNode,
RemoteNode,
RemotesNode,
RepositoryFolderNode,
RepositoryNode,
ResultsFileNode,
@ -220,10 +221,8 @@ export class ViewCommands {
}
@debug()
private addRemote(node: RemoteNode) {
if (!(node instanceof RemoteNode)) return Promise.resolve();
return GitActions.Remote.add(node.repo);
private addRemote(node?: RemotesNode) {
return GitActions.Remote.add(node?.repoPath);
}
@debug()

Ładowanie…
Anuluj
Zapisz