We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 01fbc0c commit 572ae33Copy full SHA for 572ae33
1 file changed
examples/status.js
@@ -0,0 +1,24 @@
1
+var nodegit = require("../"),
2
+ path = require("path");
3
+
4
+// This code shows working directory changes similar to git status
5
6
+nodegit.Repository.open(path.resolve(__dirname, "../.git"))
7
+ .then(function(repo) {
8
+ repo.getStatus().then(function(statuses) {
9
+ function statusToText(status) {
10
+ var words = [];
11
+ if (status.isNew()) { words.push("NEW"); }
12
+ if (status.isModified()) { words.push("MODIFIED"); }
13
+ if (status.isTypechange()) { words.push("TYPECHANGE"); }
14
+ if (status.isRenamed()) { words.push("RENAMED"); }
15
+ if (status.isIgnored()) { words.push("IGNORED"); }
16
17
+ return words.join(" ");
18
+ }
19
20
+ statuses.forEach(function(file) {
21
+ console.log(file.path() + " " + statusToText(file));
22
+ });
23
24
+});
0 commit comments