nl_tokens: Generate a files tree from the current branch taking pending changes into account .
pl_tokens: function get ( repoState , dirPath ) { // Remove trailing '/' etc. const normDirPath = Path . join ( dirPath , '.' ) ; const filepaths = DirUtils . readFilenamesRecursive ( repoState , normDirPath ) ; const tree = { value : <mask> . createDir ( normDirPath ) , children : { } } ; for ( let i = 0 ; i < filepaths . length ; i ++ ) { const relativePath = Path . relative ( normDirPath , filepaths [ i ] ) ; const parts = relativePath . split ( '/' ) ; let node = tree ; let prefix = normDirPath ; for ( let j = 0 ; j < parts . length ; j ++ ) { const head = parts [ j ] ; const isLeaf = ( j === parts . length - 1 ) ; prefix = Path . join ( prefix , head ) ; // Create node if doesn't exist if ( ! node . children [ head ] ) { if ( isLeaf ) { node . children [ head ] = { value : FileUtils . stat ( repoState , filepaths [ i ] ) } ; } else { node . children [ head ] = { value : File . createDir ( prefix ) , children : { } } ; } } node = node . children [ head ] ; } } return TreeNode . fromJS ( tree ) ; }