I am trying to use the nodejs module, gift to read the index of a Git repo. I chose 'gift' because it seemed the most promising on Windows. Does anyone know how to get the status of the Git repo using this module? I basically just want to perform a status command on my Git repo.
$ git status
Are there any other nodejs Git Modules that work well on Windows?
Thanks!
Solution
After looking through the source I found that Status is an object which is attached to Repo. You use it as described in my selected answer.
Windows caveat - I had to add git to my system path and then REBOOT. Gotta love windows :\ Even after adding git to my system path and testing it out in cmd.exe, gift kept throwing error:
command failed: 'git' is not recognized as an internal or external command, operable program or batch file.
Once I rebooted all was well.
You can get the status like this
git = require 'gift'
repo = git "path/to/repo"
repo.status(callback)
The callback receives (err, status). Status has properties
status.clean
boolean, true if working tree clean
status.files
Object - The keys are files, the values objects indicating whether or not the file is staged, tracked, etc.
Each file has the following properties:
Source for this information: the documentation.