steveukx/git-js

Status always outputs file paths relative to the repo root

Liwoj opened this issue · 1 comments

Is this bug or feature ?

If I run git status ./FsFormatConversion/*.xml

$ git status ./FsFormatConversion/*.xml                                
On branch LeveragedFinance                                             
Your branch is ahead of 'origin/LeveragedFinance' by 7 commits.        
  (use "git push" to publish your local commits)                       
                                                                       
Changes not staged for commit:                                         
  (use "git add <file>..." to update what will be committed)           
  (use "git restore <file>..." to discard changes in working directory)
        modified:   FsFormatConversion/Jednoduche2002 - AgrRevenues.xml                                                                       

If I use following code:

const { simpleGit, pathspec } = require('simple-git');
const git = simpleGit(__dirname);
const statusResult = await git.status([pathspec('./FsFormatConversion/*.xml')])
console.log(statusResult)

I get the following output:

StatusSummary {                                                                             
  not_added: [],                                                                            
  conflicted: [],                                                                           
  created: [],                                                                              
  deleted: [],                                                                              
  ignored: undefined,                                                                       
  modified: [                                                                               
    'Data/_Definitions/VUB/XML/FsFormatConversion/Jednoduche2002 - AgrRevenues.xml'         
  ],                                                                                        
  renamed: [],                                                                              
  files: [                                                                                  
    FileStatusSummary {                                                                     
      path: 'Data/_Definitions/VUB/XML/FsFormatConversion/Jednoduche2002 - AgrRevenues.xml',
      index: ' ',                                                                           
      working_dir: 'M'                                                                      
    }                                                                                       
  ],                                                                                        
  staged: [],                                                                               
  ahead: 7,                                                                                 
  behind: 0,                                                                                
  current: 'LeveragedFinance',                                                              
  tracking: 'origin/LeveragedFinance',                                                      
  detached: false,                                                                          
  isClean: [Function (anonymous)]                                                           
}                                                                                           

Is there any way to force status output to output cwd relative path ?
THX!

nvm, I get it now. Lib is using --porcelain a git status always outputs full path to repo root in that mode (docs)