Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
50 lines (46 loc) · 1.72 KB

File metadata and controls

50 lines (46 loc) · 1.72 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var path = require("path");
var rootDir = path.join(__dirname, "../..");
var exec = require(path.join(rootDir, "./utils/execPromise"));
module.exports = function getStatus() {
return exec("git submodule status", { cwd: rootDir})
.then(function(stdout) {
if (!stdout) {
// In the case where we pull from npm they pre-init the submodules for
// us and `git submodule status` returns empty-string. In that case
// we'll just assume that we're good.
return Promise.resolve([]);
}
function getStatusPromiseFromLine(line) {
var lineSections = line.trim().split(" ");
var onNewCommit = !!~lineSections[0].indexOf("+");
var needsInitialization = !!~lineSections[0].indexOf("-");
var commitOid = lineSections[0].replace("+", "").replace("-", "");
var name = lineSections[1];
return exec("git status", { cwd: path.join(rootDir, name)})
.then(function(workDirStatus) {
return {
commitOid: commitOid,
onNewCommit: onNewCommit,
name: name,
needsInitialization: needsInitialization,
workDirDirty: !~workDirStatus
.trim()
.split("\n")
.pop()
.indexOf("nothing to commit")
};
});
}
return Promise.all(stdout
.trim()
.split("\n")
.map(getStatusPromiseFromLine)
);
})
.catch(function() {
// In the case that NodeGit is required from another project via npm we
// won't be able to run submodule commands but that's ok since the
// correct version of libgit2 is published with nodegit.
return Promise.resolve([]);
});
};
Morty Proxy This is a proxified and sanitized view of the page, visit original site.