Skip to content

Commit 778da9c

Browse files
Removes setting, always uses native git (#3055)
1 parent f976187 commit 778da9c

File tree

4 files changed

+23
-85
lines changed

4 files changed

+23
-85
lines changed

package.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4038,16 +4038,6 @@
40384038
"markdownDescription": "(Experimental) Specifies whether file annotations are allowed on dirty files. Use `#gitlens.advanced.blame.delayAfterEdit#` to control how long to wait before the annotation will refresh while still dirty",
40394039
"scope": "window",
40404040
"order": 20
4041-
},
4042-
"gitlens.experimental.nativeGit": {
4043-
"type": [
4044-
"boolean",
4045-
"null"
4046-
],
4047-
"default": true,
4048-
"markdownDescription": "(Experimental) Specifies whether to use Git directly for fetch/push/pull operation instead of relying on VS Code's built-in Git implementation",
4049-
"scope": "window",
4050-
"order": 30
40514041
}
40524042
}
40534043
},

src/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export interface Config {
7474
readonly experimental: {
7575
readonly allowAnnotationsWhenDirty: boolean;
7676
readonly generateCommitMessagePrompt: string;
77-
readonly nativeGit: boolean;
7877
readonly openChangesInMultiDiffEditor: boolean;
7978
};
8079
readonly fileAnnotations: {

src/env/node/git/localGitProvider.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -368,16 +368,14 @@ export class LocalGitProvider implements GitProvider, Disposable {
368368
registerCommitMessageProvider(this.container, scmGit);
369369

370370
// Find env to pass to Git
371-
if (configuration.get('experimental.nativeGit')) {
372-
for (const v of Object.values(scmGit.git)) {
373-
if (v != null && typeof v === 'object' && 'git' in v) {
374-
for (const vv of Object.values(v.git)) {
375-
if (vv != null && typeof vv === 'object' && 'GIT_ASKPASS' in vv) {
376-
Logger.debug(scope, 'Found built-in Git env');
377-
378-
this.git.setEnv(vv);
379-
break;
380-
}
371+
for (const v of Object.values(scmGit.git)) {
372+
if (v != null && typeof v === 'object' && 'git' in v) {
373+
for (const vv of Object.values(v.git)) {
374+
if (vv != null && typeof vv === 'object' && 'GIT_ASKPASS' in vv) {
375+
Logger.debug(scope, 'Found built-in Git env');
376+
377+
this.git.setEnv(vv);
378+
break;
381379
}
382380
}
383381
}

src/git/models/repository.ts

Lines changed: 15 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { CancellationToken, ConfigurationChangeEvent, Event, Uri, WorkspaceFolder } from 'vscode';
22
import { Disposable, EventEmitter, ProgressLocation, RelativePattern, window, workspace } from 'vscode';
33
import { md5, uuid } from '@env/crypto';
4-
import { ForcePushMode } from '../../@types/vscode.git.enums';
54
import type { CreatePullRequestActionContext } from '../../api/gitlens';
65
import type { RepositoriesSorting } from '../../config';
76
import { Schemes } from '../../constants';
@@ -10,7 +9,7 @@ import type { FeatureAccess, Features, PlusFeatures } from '../../features';
109
import { showCreatePullRequestPrompt, showGenericErrorMessage } from '../../messages';
1110
import { asRepoComparisonKey } from '../../repositories';
1211
import { groupByMap } from '../../system/array';
13-
import { executeActionCommand, executeCoreGitCommand } from '../../system/command';
12+
import { executeActionCommand } from '../../system/command';
1413
import { configuration } from '../../system/configuration';
1514
import { formatDate, fromNow } from '../../system/date';
1615
import { gate } from '../../system/decorators/gate';
@@ -636,11 +635,7 @@ export class Repository implements Disposable {
636635
remote?: string;
637636
}) {
638637
try {
639-
if (options?.branch != null || configuration.get('experimental.nativeGit')) {
640-
await this.container.git.fetch(this.uri, options);
641-
} else {
642-
void (await executeCoreGitCommand('git.fetch', this.path));
643-
}
638+
await this.container.git.fetch(this.uri, options);
644639

645640
this.fireChange(RepositoryChange.Unknown);
646641
} catch (ex) {
@@ -835,22 +830,13 @@ export class Repository implements Disposable {
835830

836831
private async pullCore(options?: { rebase?: boolean }) {
837832
try {
838-
if (configuration.get('experimental.nativeGit')) {
839-
const withTags = configuration.getCore('git.pullTags', this.uri);
840-
if (configuration.getCore('git.fetchOnPull', this.uri)) {
841-
await this.container.git.fetch(this.uri);
842-
}
843-
844-
await this.container.git.pull(this.uri, { ...options, tags: withTags });
845-
} else {
846-
const upstream = await this.hasUpstreamBranch();
847-
if (upstream) {
848-
void (await executeCoreGitCommand(options?.rebase ? 'git.pullRebase' : 'git.pull', this.path));
849-
} else if (configuration.getCore('git.fetchOnPull', this.uri)) {
850-
await this.container.git.fetch(this.uri);
851-
}
833+
const withTags = configuration.getCore('git.pullTags', this.uri);
834+
if (configuration.getCore('git.fetchOnPull', this.uri)) {
835+
await this.container.git.fetch(this.uri);
852836
}
853837

838+
await this.container.git.pull(this.uri, { ...options, tags: withTags });
839+
854840
this.fireChange(RepositoryChange.Unknown);
855841
} catch (ex) {
856842
Logger.error(ex);
@@ -913,49 +899,14 @@ export class Repository implements Disposable {
913899

914900
private async pushCore(options?: { force?: boolean; reference?: GitReference; publish?: { remote: string } }) {
915901
try {
916-
if (configuration.get('experimental.nativeGit')) {
917-
await this.container.git.push(this.uri, {
918-
reference: options?.reference,
919-
force: options?.force,
920-
publish: options?.publish,
921-
});
922-
923-
if (isBranchReference(options?.reference) && options?.publish != null) {
924-
void this.showCreatePullRequestPrompt(options.publish.remote, options.reference);
925-
}
926-
} else if (isBranchReference(options?.reference)) {
927-
const repo = await this.container.git.getOrOpenScmRepository(this.uri);
928-
if (repo == null) return;
929-
930-
if (options?.publish != null) {
931-
await repo?.push(options.publish.remote, options.reference.name, true);
932-
void this.showCreatePullRequestPrompt(options.publish.remote, options.reference);
933-
} else {
934-
const branch = await this.getBranch(options?.reference.name);
935-
if (branch == null) return;
936-
937-
await repo?.push(
938-
branch.getRemoteName(),
939-
branch.name,
940-
undefined,
941-
options?.force ? ForcePushMode.ForceWithLease : undefined,
942-
);
943-
}
944-
} else if (options?.reference != null) {
945-
const repo = await this.container.git.getOrOpenScmRepository(this.uri);
946-
if (repo == null) return;
947-
948-
const branch = await this.getBranch();
949-
if (branch == null) return;
950-
951-
await repo?.push(
952-
branch.getRemoteName(),
953-
`${options.reference.ref}:${branch.getNameWithoutRemote()}`,
954-
undefined,
955-
options?.force ? ForcePushMode.ForceWithLease : undefined,
956-
);
957-
} else {
958-
void (await executeCoreGitCommand(options?.force ? 'git.pushForce' : 'git.push', this.path));
902+
await this.container.git.push(this.uri, {
903+
reference: options?.reference,
904+
force: options?.force,
905+
publish: options?.publish,
906+
});
907+
908+
if (isBranchReference(options?.reference) && options?.publish != null) {
909+
void this.showCreatePullRequestPrompt(options.publish.remote, options.reference);
959910
}
960911

961912
this.fireChange(RepositoryChange.Unknown);

0 commit comments

Comments
 (0)