@@ -1614,8 +1614,13 @@ export class LocalGitProvider implements GitProvider, Disposable {
16141614
16151615 let stdin : string | undefined ;
16161616
1617- // // TODO@eamodio this is insanity -- there *HAS* to be a better way to get git log to return stashes
1618- const stash = await this . getStash ( repoPath ) ;
1617+ const [ stashResult , headResult ] = await Promise . allSettled ( [
1618+ this . getStash ( repoPath ) ,
1619+ options ?. ref != null && options . ref !== 'HEAD' ? this . git . rev_parse ( repoPath , 'HEAD' ) : undefined ,
1620+ ] ) ;
1621+
1622+ // TODO@eamodio this is insanity -- there *HAS* to be a better way to get git log to return stashes
1623+ const stash = getSettledValue ( stashResult ) ;
16191624 if ( stash != null ) {
16201625 stdin = join (
16211626 map ( stash . commits . values ( ) , c => c . sha . substring ( 0 , 9 ) ) ,
@@ -1625,6 +1630,8 @@ export class LocalGitProvider implements GitProvider, Disposable {
16251630
16261631 let getLogForRefFn ;
16271632 if ( options ?. ref != null ) {
1633+ const head = getSettledValue ( headResult ) ;
1634+
16281635 async function getLogForRef ( this : LocalGitProvider ) : Promise < GitLog | undefined > {
16291636 let log ;
16301637
@@ -1637,7 +1644,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
16371644
16381645 let found = false ;
16391646 // If we are looking for the HEAD assume that it might be in the first page (so we can avoid extra queries)
1640- if ( options ! . ref === 'HEAD' ) {
1647+ if ( options ! . ref === 'HEAD' || options ! . ref === head ) {
16411648 log = await this . getLog ( repoPath , {
16421649 all : options ! . mode !== 'single' ,
16431650 ordering : 'date' ,
@@ -1665,11 +1672,11 @@ export class LocalGitProvider implements GitProvider, Disposable {
16651672 debugger ;
16661673 }
16671674
1668- if ( log ?. more != null && ( ! found || log . commits . size < defaultItemLimit ) ) {
1675+ if ( log ?. more != null && ( ! found || log . commits . size < defaultItemLimit / 2 ) ) {
16691676 Logger . debug ( scope , 'Loading next page...' ) ;
16701677
16711678 log = await log . more (
1672- ( log . commits . size < defaultItemLimit
1679+ ( found && log . commits . size < defaultItemLimit / 2
16731680 ? defaultItemLimit
16741681 : configuration . get ( 'graph.pageItemLimit' ) ) ?? options ?. limit ,
16751682 ) ;
0 commit comments