11import type { CancellationToken , ConfigurationChangeEvent , Event , Uri , WorkspaceFolder } from 'vscode' ;
22import { Disposable , EventEmitter , ProgressLocation , RelativePattern , window , workspace } from 'vscode' ;
33import { md5 , uuid } from '@env/crypto' ;
4- import { ForcePushMode } from '../../@types/vscode.git.enums' ;
54import type { CreatePullRequestActionContext } from '../../api/gitlens' ;
65import type { RepositoriesSorting } from '../../config' ;
76import { Schemes } from '../../constants' ;
@@ -10,7 +9,7 @@ import type { FeatureAccess, Features, PlusFeatures } from '../../features';
109import { showCreatePullRequestPrompt , showGenericErrorMessage } from '../../messages' ;
1110import { asRepoComparisonKey } from '../../repositories' ;
1211import { groupByMap } from '../../system/array' ;
13- import { executeActionCommand , executeCoreGitCommand } from '../../system/command' ;
12+ import { executeActionCommand } from '../../system/command' ;
1413import { configuration } from '../../system/configuration' ;
1514import { formatDate , fromNow } from '../../system/date' ;
1615import { 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