@@ -4,14 +4,14 @@ import type { GitLsFilesEntry, GitTreeEntry } from '../models/tree';
44const treeRegex = / (?: .+ ?) \s + ( .+ ?) \s + ( .+ ?) \s + ( .+ ?) \s + ( .+ ) / gm;
55const filesRegex = / ^ ( \S + ) \s + ( \S + ) \s + ( \S + ) \s + ( .* ) $ / gm;
66
7- export function parseGitTree ( data : string | undefined ) : GitTreeEntry [ ] {
7+ export function parseGitTree ( data : string | undefined , ref : string ) : GitTreeEntry [ ] {
88 using sw = maybeStopWatch ( `Git.parseTree` , { log : false , logLevel : 'debug' } ) ;
99
1010 const trees : GitTreeEntry [ ] = [ ] ;
1111 if ( ! data ) return trees ;
1212
1313 let type ;
14- let sha ;
14+ let oid ;
1515 let size ;
1616 let filePath ;
1717
@@ -20,11 +20,12 @@ export function parseGitTree(data: string | undefined): GitTreeEntry[] {
2020 match = treeRegex . exec ( data ) ;
2121 if ( match == null ) break ;
2222
23- [ , type , sha , size , filePath ] = match ;
23+ [ , type , oid , size , filePath ] = match ;
2424
2525 trees . push ( {
26+ ref : ref ,
2627 // Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
27- commitSha : sha == null || sha . length === 0 ? '' : ` ${ sha } ` . substr ( 1 ) ,
28+ oid : oid == null || oid . length === 0 ? '' : ` ${ oid } ` . substr ( 1 ) ,
2829 // Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
2930 path : filePath == null || filePath . length === 0 ? '' : ` ${ filePath } ` . substr ( 1 ) ,
3031 size : Number ( size ) || 0 ,
@@ -46,23 +47,23 @@ export function parseGitLsFiles(data: string | undefined): GitLsFilesEntry[] {
4647
4748 let filePath ;
4849 let mode ;
49- let object ;
50+ let oid ;
5051 let stage ;
5152
5253 let match ;
5354 do {
5455 match = filesRegex . exec ( data ) ;
5556 if ( match == null ) break ;
5657
57- [ , mode , object , stage , filePath ] = match ;
58+ [ , mode , oid , stage , filePath ] = match ;
5859
5960 files . push ( {
6061 // Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
61- path : filePath == null || filePath . length === 0 ? '' : ` ${ filePath } ` . substr ( 1 ) ,
62+ mode : mode == null || mode . length === 0 ? '' : ` ${ mode } ` . substr ( 1 ) ,
6263 // Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
63- object : object == null || object . length === 0 ? '' : ` ${ object } ` . substr ( 1 ) ,
64+ oid : oid == null || oid . length === 0 ? '' : ` ${ oid } ` . substr ( 1 ) ,
6465 // Stops excessive memory usage -- https://bugs.chromium.org/p/v8/issues/detail?id=2869
65- mode : mode == null || mode . length === 0 ? '' : ` ${ mode } ` . substr ( 1 ) ,
66+ path : filePath == null || filePath . length === 0 ? '' : ` ${ filePath } ` . substr ( 1 ) ,
6667 stage : parseInt ( stage , 10 ) ,
6768 } ) ;
6869 } while ( true ) ;
0 commit comments