@@ -1678,10 +1678,10 @@ export class GitService implements Disposable {
16781678 const fileName = GitUri . relativeTo ( uri , repoPath ) ;
16791679 let data = await Git . log__file ( repoPath , fileName , ref , {
16801680 filters : filters ,
1681- format : GitLogParser . simpleFormat ,
16821681 maxCount : skip + 1 ,
16831682 // startLine: editorLine !== undefined ? editorLine + 1 : undefined,
1684- reverse : true
1683+ reverse : true ,
1684+ simple : true
16851685 } ) ;
16861686 if ( data == null || data . length === 0 ) return undefined ;
16871687
@@ -1690,9 +1690,9 @@ export class GitService implements Disposable {
16901690 if ( status === 'D' ) {
16911691 data = await Git . log__file ( repoPath , '.' , nextRef , {
16921692 filters : [ 'R' ] ,
1693- format : GitLogParser . simpleFormat ,
1694- maxCount : 1
1693+ maxCount : 1 ,
16951694 // startLine: editorLine !== undefined ? editorLine + 1 : undefined
1695+ simple : true
16961696 } ) ;
16971697 if ( data == null || data . length === 0 ) {
16981698 return GitUri . fromFile ( file || fileName , repoPath , nextRef ) ;
@@ -1714,7 +1714,8 @@ export class GitService implements Disposable {
17141714 repoPath : string ,
17151715 uri : Uri ,
17161716 ref : string | undefined ,
1717- skip : number = 0
1717+ skip : number = 0 ,
1718+ firstParent : boolean = false
17181719 ) : Promise < { current : GitUri ; previous : GitUri | undefined } | undefined > {
17191720 if ( ref === GitService . deletedOrMissingSha ) return undefined ;
17201721
@@ -1744,14 +1745,14 @@ export class GitService implements Disposable {
17441745 return {
17451746 // Diff staged with HEAD (or prior if more skips)
17461747 current : GitUri . fromFile ( fileName , repoPath , GitService . uncommittedStagedSha ) ,
1747- previous : await this . getPreviousUri ( repoPath , uri , ref , skip - 1 )
1748+ previous : await this . getPreviousUri ( repoPath , uri , ref , skip - 1 , undefined , firstParent )
17481749 } ;
17491750 }
17501751 else if ( status . workingTreeStatus !== undefined ) {
17511752 if ( skip === 0 ) {
17521753 return {
17531754 current : GitUri . fromFile ( fileName , repoPath , undefined ) ,
1754- previous : await this . getPreviousUri ( repoPath , uri , undefined , skip )
1755+ previous : await this . getPreviousUri ( repoPath , uri , undefined , skip , undefined , firstParent )
17551756 } ;
17561757 }
17571758 }
@@ -1765,25 +1766,25 @@ export class GitService implements Disposable {
17651766 const current =
17661767 skip === 0
17671768 ? GitUri . fromFile ( fileName , repoPath , ref )
1768- : ( await this . getPreviousUri ( repoPath , uri , undefined , skip - 1 ) ) ! ;
1769+ : ( await this . getPreviousUri ( repoPath , uri , undefined , skip - 1 , undefined , firstParent ) ) ! ;
17691770 if ( current === undefined || current . sha === GitService . deletedOrMissingSha ) return undefined ;
17701771
17711772 return {
17721773 current : current ,
1773- previous : await this . getPreviousUri ( repoPath , uri , undefined , skip )
1774+ previous : await this . getPreviousUri ( repoPath , uri , undefined , skip , undefined , firstParent )
17741775 } ;
17751776 }
17761777
17771778 // If we are at a commit, diff commit with previous
17781779 const current =
17791780 skip === 0
17801781 ? GitUri . fromFile ( fileName , repoPath , ref )
1781- : ( await this . getPreviousUri ( repoPath , uri , ref , skip - 1 ) ) ! ;
1782+ : ( await this . getPreviousUri ( repoPath , uri , ref , skip - 1 , undefined , firstParent ) ) ! ;
17821783 if ( current === undefined || current . sha === GitService . deletedOrMissingSha ) return undefined ;
17831784
17841785 return {
17851786 current : current ,
1786- previous : await this . getPreviousUri ( repoPath , uri , ref , skip )
1787+ previous : await this . getPreviousUri ( repoPath , uri , ref , skip , undefined , firstParent )
17871788 } ;
17881789 }
17891790
@@ -1904,7 +1905,8 @@ export class GitService implements Disposable {
19041905 uri : Uri ,
19051906 ref ?: string ,
19061907 skip : number = 0 ,
1907- editorLine ?: number
1908+ editorLine ?: number ,
1909+ firstParent : boolean = false
19081910 ) : Promise < GitUri | undefined > {
19091911 if ( ref === GitService . deletedOrMissingSha ) return undefined ;
19101912
@@ -1914,17 +1916,14 @@ export class GitService implements Disposable {
19141916 ref = undefined ;
19151917 }
19161918
1917- if ( ref !== undefined ) {
1918- skip ++ ;
1919- }
1920-
19211919 const fileName = GitUri . relativeTo ( uri , repoPath ) ;
19221920 // TODO: Add caching
19231921 let data ;
19241922 try {
19251923 data = await Git . log__file ( repoPath , fileName , ref , {
1926- format : GitLogParser . simpleFormat ,
1927- maxCount : skip + 1 ,
1924+ maxCount : skip + 2 ,
1925+ firstParent : firstParent ,
1926+ simple : true ,
19281927 startLine : editorLine !== undefined ? editorLine + 1 : undefined
19291928 } ) ;
19301929 }
@@ -1950,7 +1949,7 @@ export class GitService implements Disposable {
19501949 }
19511950 if ( data == null || data . length === 0 ) return undefined ;
19521951
1953- const [ previousRef , file ] = GitLogParser . parseSimple ( data , skip , editorLine !== undefined ? ref : undefined ) ;
1952+ const [ previousRef , file ] = GitLogParser . parseSimple ( data , skip , ref ) ;
19541953 // If the previous ref matches the ref we asked for assume we are at the end of the history
19551954 if ( ref !== undefined && ref === previousRef ) return undefined ;
19561955
@@ -2343,8 +2342,8 @@ export class GitService implements Disposable {
23432342 // Now check if that commit had any renames
23442343 data = await Git . log__file ( repoPath , '.' , ref , {
23452344 filters : [ 'R' ] ,
2346- format : GitLogParser . simpleFormat ,
2347- maxCount : 1
2345+ maxCount : 1 ,
2346+ simple : true
23482347 } ) ;
23492348 if ( data == null || data . length === 0 ) {
23502349 return GitUri . resolveToUri ( fileName , repoPath ) ;
0 commit comments