@ -1215,14 +1215,14 @@ export class GitService implements Disposable {
let [ branch ] = await this . getBranches ( repoPath , { filter : b = > b . current } ) ;
if ( branch != null ) return branch ;
const data = await Git . rev_parse__currentBranch ( repoPath ) ;
const data = await Git . rev_parse__currentBranch ( repoPath , Container . config . advanced . commitOrdering );
if ( data == null ) return undefined ;
const [ name , tracking ] = data [ 0 ] . split ( '\n' ) ;
if ( GitBranch . isDetached ( name ) ) {
const [ rebaseStatus , committerDate ] = await Promise . all ( [
this . getRebaseStatus ( repoPath ) ,
Git . log__recent_committerdate ( repoPath ) ,
Git . log__recent_committerdate ( repoPath , Container . config . advanced . commitOrdering ),
] ) ;
branch = new GitBranch (
@ -1300,12 +1300,12 @@ export class GitService implements Disposable {
if ( data == null || data . length === 0 ) {
let current ;
const data = await Git . rev_parse__currentBranch ( repoPath ) ;
const data = await Git . rev_parse__currentBranch ( repoPath , Container . config . advanced . commitOrdering );
if ( data != null ) {
const [ name , tracking ] = data [ 0 ] . split ( '\n' ) ;
const [ rebaseStatus , committerDate ] = await Promise . all ( [
GitBranch . isDetached ( name ) ? this . getRebaseStatus ( repoPath ) : undefined ,
Git . log__recent_committerdate ( repoPath ) ,
Git . log__recent_committerdate ( repoPath , Container . config . advanced . commitOrdering ),
] ) ;
current = new GitBranch (
@ -1498,6 +1498,7 @@ export class GitService implements Disposable {
async getOldestUnpushedRefForFile ( repoPath : string , fileName : string ) : Promise < string | undefined > {
const data = await Git . log__file ( repoPath , fileName , '@{push}..' , {
format : 'refs' ,
ordering : Container.config.advanced.commitOrdering ,
renames : true ,
} ) ;
if ( data == null || data . length === 0 ) return undefined ;
@ -1876,6 +1877,7 @@ export class GitService implements Disposable {
authors? : string [ ] ;
limit? : number ;
merges? : boolean ;
ordering? : string | null ;
ref? : string ;
reverse? : boolean ;
since? : string ;
@ -1888,6 +1890,7 @@ export class GitService implements Disposable {
authors : options.authors ,
limit : limit ,
merges : options.merges == null ? true : options . merges ,
ordering : options.ordering ? ? Container . config . advanced . commitOrdering ,
reverse : options.reverse ,
similarityThreshold : Container.config.advanced.similarityThreshold ,
since : options.since ,
@ -1928,6 +1931,7 @@ export class GitService implements Disposable {
authors? : string [ ] ;
limit? : number ;
merges? : boolean ;
ordering? : string | null ;
ref? : string ;
reverse? : boolean ;
since? : string ;
@ -1944,6 +1948,7 @@ export class GitService implements Disposable {
reverse : options.reverse ,
similarityThreshold : Container.config.advanced.similarityThreshold ,
since : options.since ,
ordering : options.ordering ? ? Container . config . advanced . commitOrdering ,
} ) ;
const commits = GitLogParser . parseRefsOnly ( data ) ;
return new Set ( commits ) ;
@ -1954,7 +1959,14 @@ export class GitService implements Disposable {
private getLogMoreFn (
log : GitLog ,
options : { authors? : string [ ] ; limit? : number ; merges? : boolean ; ref? : string ; reverse? : boolean } ,
options : {
authors? : string [ ] ;
limit? : number ;
merges? : boolean ;
ordering? : string | null ;
ref? : string ;
reverse? : boolean ;
} ,
) : ( limit : number | { until : string } | undefined ) = > Promise < GitLog > {
return async ( limit : number | { until : string } | undefined ) = > {
const moreUntil = limit != null && typeof limit === 'object' ? limit.until : undefined ;
@ -2021,7 +2033,7 @@ export class GitService implements Disposable {
async getLogForSearch (
repoPath : string ,
search : SearchPattern ,
options : { limit? : number ; skip? : number } = { } ,
options : { limit? : number ; ordering? : string | null ; skip? : number } = { } ,
) : Promise < GitLog | undefined > {
search = { matchAll : false , matchCase : false , matchRegex : true , . . . search } ;
@ -2098,7 +2110,12 @@ export class GitService implements Disposable {
args . push ( . . . files ) ;
}
const data = await Git . log__search ( repoPath , args , { . . . options , limit : limit , useShow : useShow } ) ;
const data = await Git . log__search ( repoPath , args , {
ordering : Container.config.advanced.commitOrdering ,
. . . options ,
limit : limit ,
useShow : useShow ,
} ) ;
const log = GitLogParser . parse (
data ,
GitCommitType . Log ,
@ -2128,7 +2145,7 @@ export class GitService implements Disposable {
private getLogForSearchMoreFn (
log : GitLog ,
search : SearchPattern ,
options : { limit? : number } ,
options : { limit? : number ; ordering? : string | null } ,
) : ( limit : number | undefined ) = > Promise < GitLog > {
return async ( limit : number | undefined ) = > {
limit = limit ? ? Container . config . advanced . maxSearchItems ? ? 0 ;
@ -2180,6 +2197,7 @@ export class GitService implements Disposable {
options : {
all? : boolean ;
limit? : number ;
ordering? : string | null ;
range? : Range ;
ref? : string ;
renames? : boolean ;
@ -2330,6 +2348,7 @@ export class GitService implements Disposable {
} : {
all? : boolean ;
limit? : number ;
ordering? : string | null ;
range? : Range ;
ref? : string ;
renames? : boolean ;
@ -2354,6 +2373,7 @@ export class GitService implements Disposable {
}
const data = await Git . log__file ( root , file , ref , {
ordering : Container.config.advanced.commitOrdering ,
. . . options ,
firstParent : options.renames ,
startLine : range == null ? undefined : range . start . line + 1 ,
@ -2404,7 +2424,15 @@ export class GitService implements Disposable {
private getLogForFileMoreFn (
log : GitLog ,
fileName : string ,
options : { all? : boolean ; limit? : number ; range? : Range ; ref? : string ; renames? : boolean ; reverse? : boolean } ,
options : {
all? : boolean ;
limit? : number ;
ordering? : string | null ;
range? : Range ;
ref? : string ;
renames? : boolean ;
reverse? : boolean ;
} ,
) : ( limit : number | { until : string } | undefined ) = > Promise < GitLog > {
return async ( limit : number | { until : string } | undefined ) = > {
const moreUntil = limit != null && typeof limit === 'object' ? limit.until : undefined ;
@ -2669,10 +2697,11 @@ export class GitService implements Disposable {
const fileName = GitUri . relativeTo ( uri , repoPath ) ;
let data = await Git . log__file ( repoPath , fileName , ref , {
filters : filters ,
format : 'simple' ,
limit : skip + 1 ,
// startLine: editorLine != null ? editorLine + 1 : undefined,
ordering : Container.config.advanced.commitOrdering ,
reverse : true ,
format : 'simple' ,
// startLine: editorLine != null ? editorLine + 1 : undefined,
} ) ;
if ( data == null || data . length === 0 ) return undefined ;
@ -2681,9 +2710,10 @@ export class GitService implements Disposable {
if ( status === 'D' ) {
data = await Git . log__file ( repoPath , '.' , nextRef , {
filters : [ 'R' , 'C' ] ,
format : 'simple' ,
limit : 1 ,
ordering : Container.config.advanced.commitOrdering ,
// startLine: editorLine != null ? editorLine + 1 : undefined
format : 'simple' ,
} ) ;
if ( data == null || data . length === 0 ) {
return GitUri . fromFile ( file ? ? fileName , repoPath , nextRef ) ;
@ -2918,9 +2948,10 @@ export class GitService implements Disposable {
let data ;
try {
data = await Git . log__file ( repoPath , fileName , ref , {
limit : skip + 2 ,
firstParent : firstParent ,
format : 'simple' ,
limit : skip + 2 ,
ordering : Container.config.advanced.commitOrdering ,
startLine : editorLine != null ? editorLine + 1 : undefined ,
} ) ;
} catch ( ex ) {
@ -2934,7 +2965,9 @@ export class GitService implements Disposable {
}
}
ref = await Git . log__file_recent ( repoPath , fileName ) ;
ref = await Git . log__file_recent ( repoPath , fileName , {
ordering : Container.config.advanced.commitOrdering ,
} ) ;
return GitUri . fromFile ( fileName , repoPath , ref ? ? GitRevision . deletedOrMissing ) ;
}
@ -3056,14 +3089,21 @@ export class GitService implements Disposable {
@log ( )
async getIncomingActivity (
repoPath : string ,
{ limit , . . . options } : { all? : boolean ; branch? : string ; limit? : number ; skip? : number } = { } ,
{
limit ,
. . . options
} : { all? : boolean ; branch? : string ; limit? : number ; ordering? : string | null ; skip? : number } = { } ,
) : Promise < GitReflog | undefined > {
const cc = Logger . getCorrelationContext ( ) ;
limit = limit ? ? Container . config . advanced . maxListItems ? ? 0 ;
try {
// Pass a much larger limit to reflog, because we aggregate the data and we won't know how many lines we'll need
const data = await Git . reflog ( repoPath , { . . . options , limit : limit * 100 } ) ;
const data = await Git . reflog ( repoPath , {
ordering : Container.config.advanced.commitOrdering ,
. . . options ,
limit : limit * 100 ,
} ) ;
if ( data == null ) return undefined ;
const reflog = GitReflogParser . parse ( data , repoPath , reflogCommands , limit , limit * 100 ) ;
@ -3080,7 +3120,7 @@ export class GitService implements Disposable {
private getReflogMoreFn (
reflog : GitReflog ,
options : { all? : boolean ; branch? : string ; limit? : number ; skip? : number } ,
options : { all? : boolean ; branch? : string ; limit? : number ; ordering? : string | null ; skip? : number } ,
) : ( limit : number ) = > Promise < GitReflog > {
return async ( limit : number | undefined ) = > {
limit = limit ? ? Container . config . advanced . maxSearchItems ? ? 0 ;
@ -3721,6 +3761,7 @@ export class GitService implements Disposable {
// TODO: Add caching
// Get the most recent commit for this file name
ref = await Git . log__file_recent ( repoPath , fileName , {
ordering : Container.config.advanced.commitOrdering ,
similarityThreshold : Container.config.advanced.similarityThreshold ,
} ) ;
if ( ref == null ) return undefined ;
@ -3728,8 +3769,9 @@ export class GitService implements Disposable {
// Now check if that commit had any renames
data = await Git . log__file ( repoPath , '.' , ref , {
filters : [ 'R' , 'C' , 'D' ] ,
limit : 1 ,
format : 'simple' ,
limit : 1 ,
ordering : Container.config.advanced.commitOrdering ,
} ) ;
if ( data == null || data . length === 0 ) break ;
@ -4012,7 +4054,13 @@ export class GitService implements Disposable {
const blob = await Git . rev_parse__verify ( repoPath , ref , fileName ) ;
if ( blob == null ) return GitRevision . deletedOrMissing ;
let promise : Promise < string | void | undefined > = Git . log__find_object ( repoPath , blob , ref , fileName ) ;
let promise : Promise < string | void | undefined > = Git . log__find_object (
repoPath ,
blob ,
ref ,
Container . config . advanced . commitOrdering ,
fileName ,
) ;
if ( options ? . timeout != null ) {
promise = Promise . race ( [ promise , Functions . wait ( options . timeout ) ] ) ;
}