a cache object
The working tree directory path
Optional
filepaths?: string[]Limit the query to the given files and directories
Optional
filter?: ((arg0: string) => boolean)Filter the results to only those whose filepath matches a function.
Optional
gitdir?: string[required] The git directory path
Optional
ignored?: booleaninclude ignored files in the result
Optionally specify a different commit to compare against the workdir and stage instead of the HEAD
Optional
ref2?: stringOptionally specify a different commit to compare against the
Resolves with a status matrix, described below.
Efficiently get the status of multiple files at once.
The returned
StatusMatrix
is admittedly not the easiest format to read. However it conveys a large amount of information in dense format that should make it easy to create reports about the current state of the repository; without having to do multiple, time-consuming isomorphic-git calls. My hope is that the speed and flexibility of the function will make up for the learning curve of interpreting the return value.The result is returned as a 2D array. The outer array represents the files and/or blobs in the repo, in alphabetical order. The inner arrays describe the status of the file: the first value is the filepath, and the next three are integers representing the HEAD status, WORKDIR status, and STAGE status of the entry.
Here are some examples of queries you can answer using the result:
Q: What files have been deleted?
Q: What files have unstaged changes?
Q: What files have been modified since the last commit?
Q: What files will NOT be changed if I commit right now?
For reference, here are all possible combinations:
git status --short
equivalentAD
??
A
AM
D
D
MD
D
+??
MM
D
+??
M
M
MM