Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/commands/closeUnchangedFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class CloseUnchangedFilesCommand extends Command {
const repository = await getRepositoryOrShowPicker('Close All Unchanged Files');
if (repository == null) return;

const status = await this.container.git.getStatusForRepo(repository.uri);
const status = await this.container.git.getStatus(repository.uri);
if (status == null) {
void window.showWarningMessage('Unable to close unchanged files');

Expand Down
2 changes: 1 addition & 1 deletion src/commands/copyCurrentBranch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class CopyCurrentBranchCommand extends ActiveEditorCommand {
if (repository == null) return;

try {
const branch = await repository.getBranch();
const branch = await repository.git.getBranch();
if (branch?.name) {
await env.clipboard.writeText(branch.name);
}
Expand Down
6 changes: 3 additions & 3 deletions src/commands/createPullRequestOnRemote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class CreatePullRequestOnRemoteCommand extends Command {
if (repo == null) return;

if (args == null) {
const branch = await repo.getBranch();
const branch = await repo.git.getBranch();
if (branch?.upstream == null) {
void window.showErrorMessage(
`Unable to create a pull request for branch \`${branch?.name}\` because it has no upstream branch`,
Expand All @@ -51,11 +51,11 @@ export class CreatePullRequestOnRemoteCommand extends Command {
};
}

const compareRemote = await repo.getRemote(args.remote);
const compareRemote = await repo.git.getRemote(args.remote);
if (compareRemote?.provider == null) return;

const providerId = compareRemote.provider.id;
const remotes = (await repo.getRemotes({
const remotes = (await repo.git.getRemotes({
filter: r => r.provider?.id === providerId,
sort: true,
})) as GitRemote<RemoteProvider>[];
Expand Down
2 changes: 1 addition & 1 deletion src/commands/diffWithRevision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class DiffWithRevisionCommand extends ActiveEditorCommand {
getState: async () => {
const items: (CommandQuickPickItem | DirectiveQuickPickItem)[] = [];

const status = await this.container.git.getStatusForRepo(gitUri.repoPath);
const status = await this.container.git.getStatus(gitUri.repoPath);
if (status != null) {
for (const f of status.files) {
if (f.workingTreeStatus === '?' || f.workingTreeStatus === '!') {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/externalDiff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class ExternalDiffCommand extends Command {
const repository = await getRepositoryOrShowPicker('Open All Changes (difftool)');
if (repository == null) return undefined;

const status = await this.container.git.getStatusForRepo(repository.uri);
const status = await this.container.git.getStatus(repository.uri);
if (status == null) {
return window.showInformationMessage("The repository doesn't have any changes");
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/ghpr/openOrCreateWorktree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class OpenOrCreateWorktreeCommand extends Command {
const remoteUrl = remoteUri.toString();
const [, remoteDomain, remotePath] = parseGitRemoteUrl(remoteUrl);

const remotes = await repo.getRemotes({ filter: r => r.matches(remoteDomain, remotePath) });
const remotes = await repo.git.getRemotes({ filter: r => r.matches(remoteDomain, remotePath) });
const remote = remotes[0] as GitRemote | undefined;

let addRemote: { name: string; url: string } | undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/git/branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export class BranchGitCommand extends QuickCommand {
const result = yield* pickBranchOrTagStep(state, context, {
placeholder: context =>
`Choose a branch${context.showTags ? ' or tag' : ''} to create the new branch from`,
picked: state.reference?.ref ?? (await state.repo.getBranch())?.ref,
picked: state.reference?.ref ?? (await state.repo.git.getBranch())?.ref,
titleContext: ' from',
value: isRevisionReference(state.reference) ? state.reference.ref : undefined,
});
Expand Down
4 changes: 2 additions & 2 deletions src/commands/git/cherry-pick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class CherryPickGitCommand extends QuickCommand<State> {
}

if (context.destination == null) {
const branch = await state.repo.getBranch();
const branch = await state.repo.git.getBranch();
if (branch == null) break;

context.destination = branch;
Expand Down Expand Up @@ -179,7 +179,7 @@ export class CherryPickGitCommand extends QuickCommand<State> {
{ mode: 'contains' },
);
if (branches.length) {
const branch = await state.repo.getBranch(branches[0]);
const branch = await state.repo.git.getBranch(branches[0]);
if (branch != null) {
context.selectedBranchOrTag = branch;
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/git/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export class LogGitCommand extends QuickCommand<State> {
assertStateStepRepository(state);

if (state.reference === 'HEAD') {
const branch = await state.repo.getBranch();
const branch = await state.repo.git.getBranch();
state.reference = branch;
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/git/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class MergeGitCommand extends QuickCommand<State> {
}

if (context.destination == null) {
const branch = await state.repo.getBranch();
const branch = await state.repo.git.getBranch();
if (branch == null) break;

context.destination = branch;
Expand Down
6 changes: 3 additions & 3 deletions src/commands/git/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class PullGitCommand extends QuickCommand<State> {
if (isBranchReference(state.reference)) {
// Only resort to a branch fetch if the branch isn't the current one
if (!isBranch(state.reference) || !state.reference.current) {
const currentBranch = await state.repos[0].getBranch();
const currentBranch = await state.repos[0].git.getBranch();
if (currentBranch?.name !== state.reference.name) {
return state.repos[0].fetch({ branch: state.reference, pull: true });
}
Expand Down Expand Up @@ -167,7 +167,7 @@ export class PullGitCommand extends QuickCommand<State> {
);
} else {
const [repo] = state.repos;
const branch = await repo.getBranch(state.reference.name);
const branch = await repo.git.getBranch(state.reference.name);

if (branch?.upstream == null) {
step = this.createConfirmStep(
Expand All @@ -193,7 +193,7 @@ export class PullGitCommand extends QuickCommand<State> {
}
} else {
const [repo] = state.repos;
const [status, lastFetched] = await Promise.all([repo.getStatus(), repo.getLastFetched()]);
const [status, lastFetched] = await Promise.all([repo.git.getStatus(), repo.getLastFetched()]);

let lastFetchedOn = '';
if (lastFetched !== 0) {
Expand Down
8 changes: 4 additions & 4 deletions src/commands/git/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ export class PushGitCommand extends QuickCommand<State> {
{ placeholder: 'Cannot push a remote branch' },
);
} else {
const branch = await repo.getBranch(state.reference.name);
const branch = await repo.git.getBranch(state.reference.name);

if (branch != null && branch?.upstream == null) {
for (const remote of await repo.getRemotes()) {
for (const remote of await repo.git.getRemotes()) {
items.push(
createFlagsQuickPickItem<Flags>(
state.flags,
Expand Down Expand Up @@ -294,7 +294,7 @@ export class PushGitCommand extends QuickCommand<State> {
}
}
} else {
const status = await repo.getStatus();
const status = await repo.git.getStatus();

const branch: GitBranchReference = {
refType: 'branch',
Expand All @@ -317,7 +317,7 @@ export class PushGitCommand extends QuickCommand<State> {
pushDetails = '';
}

for (const remote of await repo.getRemotes()) {
for (const remote of await repo.git.getRemotes()) {
items.push(
createFlagsQuickPickItem<Flags>(
state.flags,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/git/rebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class RebaseGitCommand extends QuickCommand<State> {
}

if (context.destination == null) {
const branch = await state.repo.getBranch();
const branch = await state.repo.git.getBranch();
if (branch == null) break;

context.destination = branch;
Expand Down
12 changes: 6 additions & 6 deletions src/commands/git/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export class RemoteGitCommand extends QuickCommand<State> {
state.flags = ['-f'];
}

let alreadyExists = (await state.repo.getRemotes({ filter: r => r.name === state.name })).length !== 0;
let alreadyExists = (await state.repo.git.getRemotes({ filter: r => r.name === state.name })).length !== 0;

while (this.canStepsContinue(state)) {
if (state.counter < 3 || state.name == null || alreadyExists) {
Expand All @@ -298,7 +298,7 @@ export class RemoteGitCommand extends QuickCommand<State> {
});
if (result === StepResultBreak) continue;

alreadyExists = (await state.repo.getRemotes({ filter: r => r.name === result })).length !== 0;
alreadyExists = (await state.repo.git.getRemotes({ filter: r => r.name === result })).length !== 0;
if (alreadyExists) {
state.counter--;
continue;
Expand Down Expand Up @@ -360,7 +360,7 @@ export class RemoteGitCommand extends QuickCommand<State> {
while (this.canStepsContinue(state)) {
if (state.remote != null) {
if (typeof state.remote === 'string') {
const [remote] = await state.repo.getRemotes({ filter: r => r.name === state.remote });
const [remote] = await state.repo.git.getRemotes({ filter: r => r.name === state.remote });
if (remote != null) {
state.remote = remote;
} else {
Expand All @@ -386,7 +386,7 @@ export class RemoteGitCommand extends QuickCommand<State> {

endSteps(state);
try {
await state.repo.removeRemote(state.remote.name);
await state.repo.git.removeRemote(state.remote.name);
} catch (ex) {
Logger.error(ex);
void showGenericErrorMessage('Unable to remove remote');
Expand Down Expand Up @@ -416,7 +416,7 @@ export class RemoteGitCommand extends QuickCommand<State> {
while (this.canStepsContinue(state)) {
if (state.remote != null) {
if (typeof state.remote === 'string') {
const [remote] = await state.repo.getRemotes({ filter: r => r.name === state.remote });
const [remote] = await state.repo.git.getRemotes({ filter: r => r.name === state.remote });
if (remote != null) {
state.remote = remote;
} else {
Expand All @@ -441,7 +441,7 @@ export class RemoteGitCommand extends QuickCommand<State> {
if (result === StepResultBreak) continue;

endSteps(state);
void state.repo.pruneRemote(state.remote.name);
void state.repo.git.pruneRemote(state.remote.name);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/git/reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class ResetGitCommand extends QuickCommand<State> {
}

if (context.destination == null) {
const branch = await state.repo.getBranch();
const branch = await state.repo.git.getBranch();
if (branch == null) break;

context.destination = branch;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/git/revert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class RevertGitCommand extends QuickCommand<State> {
}

if (context.destination == null) {
const branch = await state.repo.getBranch();
const branch = await state.repo.git.getBranch();
if (branch == null) break;

context.destination = branch;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/git/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export class SearchGitCommand extends QuickCommand<State> {
const searchKey = getSearchQueryComparisonKey(search);

if (context.resultsPromise == null || context.resultsKey !== searchKey) {
context.resultsPromise = state.repo.richSearchCommits(search);
context.resultsPromise = state.repo.git.richSearchCommits(search);
context.resultsKey = searchKey;
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/git/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class StatusGitCommand extends QuickCommand<State> {
}
}

context.status = (await state.repo.getStatus())!;
context.status = (await state.repo.git.getStatus())!;
if (context.status == null) return;

context.title = `${this.title}${pad(GlyphChars.Dot, 2, 2)}${getReferenceLabel(
Expand Down
2 changes: 1 addition & 1 deletion src/commands/git/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export class TagGitCommand extends QuickCommand<State> {
const result = yield* pickBranchOrTagStep(state, context, {
placeholder: context =>
`Choose a branch${context.showTags ? ' or tag' : ''} to create the new tag from`,
picked: state.reference?.ref ?? (await state.repo.getBranch())?.ref,
picked: state.reference?.ref ?? (await state.repo.git.getBranch())?.ref,
titleContext: ' from',
value: isRevisionReference(state.reference) ? state.reference.ref : undefined,
});
Expand Down
16 changes: 8 additions & 8 deletions src/commands/git/worktree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ export class WorktreeGitCommand extends QuickCommand<State> {

private async *createCommandSteps(state: CreateStepState, context: Context): AsyncStepResultGenerator<void> {
if (context.defaultUri == null) {
context.defaultUri = await state.repo.getWorktreesDefaultUri();
context.defaultUri = await state.repo.git.getWorktreesDefaultUri();
}

if (state.flags == null) {
Expand All @@ -399,7 +399,7 @@ export class WorktreeGitCommand extends QuickCommand<State> {
const result = yield* pickBranchOrTagStep(state, context, {
placeholder: context =>
`Choose a branch${context.showTags ? ' or tag' : ''} to create the new worktree for`,
picked: state.reference?.ref ?? (await state.repo.getBranch())?.ref,
picked: state.reference?.ref ?? (await state.repo.git.getBranch())?.ref,
titleContext: ' for',
value: isRevisionReference(state.reference) ? state.reference.ref : undefined,
});
Expand All @@ -425,7 +425,7 @@ export class WorktreeGitCommand extends QuickCommand<State> {

if (isRemoteBranch) {
state.createBranch = getNameWithoutRemote(state.reference);
const branch = await state.repo.getBranch(state.createBranch);
const branch = await state.repo.git.getBranch(state.createBranch);
if (branch != null && !branch.remote) {
state.createBranch = branch.name;
}
Expand All @@ -436,7 +436,7 @@ export class WorktreeGitCommand extends QuickCommand<State> {
if (state.createBranch != null) {
let valid = await this.container.git.validateBranchOrTagName(state.repo.path, state.createBranch);
if (valid) {
const alreadyExists = await state.repo.getBranch(state.createBranch);
const alreadyExists = await state.repo.git.getBranch(state.createBranch);
valid = alreadyExists == null;
}

Expand Down Expand Up @@ -830,7 +830,7 @@ export class WorktreeGitCommand extends QuickCommand<State> {
}

private async *deleteCommandSteps(state: DeleteStepState, context: Context): StepGenerator {
context.worktrees = await state.repo.getWorktrees();
context.worktrees = await state.repo.git.getWorktrees();

if (state.flags == null) {
state.flags = [];
Expand Down Expand Up @@ -895,7 +895,7 @@ export class WorktreeGitCommand extends QuickCommand<State> {
}
}

await state.repo.deleteWorktree(uri, { force: force });
await state.repo.git.deleteWorktree(uri, { force: force });
if (deleteBranches && worktree?.branch) {
branchesToDelete.push(getReferenceFromBranch(worktree?.branch));
}
Expand Down Expand Up @@ -1012,7 +1012,7 @@ export class WorktreeGitCommand extends QuickCommand<State> {
while (this.canStepsContinue(state)) {
if (state.counter < 3 || state.worktree == null) {
context.title = getTitle(state.subcommand);
context.worktrees ??= await state.repo.getWorktrees();
context.worktrees ??= await state.repo.git.getWorktrees();

const result = yield* pickWorktreeStep(state, context, {
excludeOpened: true,
Expand Down Expand Up @@ -1114,7 +1114,7 @@ export class WorktreeGitCommand extends QuickCommand<State> {
context.title = state?.overrides?.title ?? getTitle(state.subcommand);

if (state.counter < 3 || state.worktree == null) {
context.worktrees ??= await state.repo.getWorktrees();
context.worktrees ??= await state.repo.git.getWorktrees();

let placeholder;
switch (state.changes.type) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/openAssociatedPullRequestOnRemote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class OpenAssociatedPullRequestOnRemoteCommand extends ActiveEditorComman
});
if (repo == null) return;

const branch = await repo?.getBranch();
const branch = await repo?.git.getBranch();
const pr = await branch?.getAssociatedPullRequest({ expiryOverride: true });

args =
Expand Down
2 changes: 1 addition & 1 deletion src/commands/openChangedFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class OpenChangedFilesCommand extends Command {
const repository = await getRepositoryOrShowPicker('Open All Changed Files');
if (repository == null) return;

const status = await this.container.git.getStatusForRepo(repository.uri);
const status = await this.container.git.getStatus(repository.uri);
if (status == null) {
void window.showWarningMessage('Unable to open changed files');

Expand Down
2 changes: 1 addition & 1 deletion src/commands/openCurrentBranchOnRemote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class OpenCurrentBranchOnRemoteCommand extends ActiveEditorCommand {
if (repository == null) return;

try {
const branch = await repository.getBranch();
const branch = await repository.git.getBranch();
if (branch?.name) {
void (await executeCommand<OpenOnRemoteCommandArgs>(Commands.OpenOnRemote, {
resource: {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/openFileAtRevision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class OpenFileAtRevisionCommand extends ActiveEditorCommand {
getState: async () => {
const items: (CommandQuickPickItem | DirectiveQuickPickItem)[] = [];

const status = await this.container.git.getStatusForRepo(gitUri.repoPath);
const status = await this.container.git.getStatus(gitUri.repoPath);
if (status != null) {
for (const f of status.files) {
if (f.workingTreeStatus === '?' || f.workingTreeStatus === '!') {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/openOnlyChangedFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class OpenOnlyChangedFilesCommand extends Command {
const repository = await getRepositoryOrShowPicker('Open Changed & Close Unchanged Files');
if (repository == null) return;

const status = await this.container.git.getStatusForRepo(repository.uri);
const status = await this.container.git.getStatus(repository.uri);
if (status == null) {
void window.showWarningMessage('Unable to open changed & close unchanged files');

Expand Down
Loading