GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fork-nodegit-nodegit/lifecycleScripts/submodules/index.js at master · marbug/fork-nodegit-nodegit

Expand file tree

/

index.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
82 lines (72 loc) · 2.47 KB
/

index.js

Copy path

File metadata and controls

82 lines (72 loc) · 2.47 KB
Raw
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
var path = require("path");
var rootDir = path.join(__dirname, "../..");
var gitExecutableLocation = require(
path.join(rootDir, "./utils/gitExecutableLocation")
);
var submoduleStatus = require("./getStatus");
var exec = require(path.join(rootDir, "./utils/execPromise"));
module.exports = function submodules() {
return gitExecutableLocation()
.catch(function() {
console.error("[nodegit] ERROR - Compilation of NodeGit requires git " +
"CLI to be installed and on the path");
throw new Error("git CLI is not installed or not on the path");
})
.then(function() {
console.log("[nodegit] Checking submodule status");
return submoduleStatus();
})
.then(function(statuses) {
function printSubmodule(submoduleName) {
console.log("\t" + submoduleName);
}
var dirtySubmodules = statuses
.filter(function(status) {
return status.workDirDirty && !status.needsInitialization;
})
.map(function(dirtySubmodule) {
return dirtySubmodule.name;
});
if (dirtySubmodules.length) {
console.error(
"[nodegit] ERROR - Some submodules have uncommited changes:"
);
dirtySubmodules.forEach(printSubmodule);
console.error(
"\nThey must either be committed or discarded before we build"
);
throw new Error("Dirty Submodules: " + dirtySubmodules.join(" "));
}
var outOfSyncSubmodules = statuses
.filter(function(status) {
return status.onNewCommit && !status.needsInitialization;
})
.map(function(outOfSyncSubmodule) {
return outOfSyncSubmodule.name;
});
if (outOfSyncSubmodules.length) {
console.warn(
"[nodegit] WARNING - Some submodules are pointing to an new commit:"
);
outOfSyncSubmodules.forEach(printSubmodule);
console.warn("\nThey will not be updated.");
}
return statuses
.filter(function(status) {
return !status.onNewCommit;
})
.reduce(function(chainPromise, submoduleToUpdate) {
return chainPromise
.then(function() {
console.log(
"[nodegit] Initializing submodule",
submoduleToUpdate.name
);
return exec(
"git submodule update --init --recursive " +
submoduleToUpdate.name
);
});
}, Promise.resolve());
});
};
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.