History

Update Git documentation (2.30.0)

Simon Legner committed 5 years ago

Commit 3600a9f1 parent 8f17cfa41 files · +4398 −1Browse files

Showing the changes to node_modules/simple-git/src/responses/MoveSummary.js (1 of 41 files). Show all

Unified · Split

node_modules/simple-git/src/responses/MoveSummary.js+32−0
@@ -0,0 +1,32 @@
1+
2+module.exports = MoveSummary;
3+
4+/**
5+ * The MoveSummary is returned as a response to getting `git().status()`
6+ *
7+ * @constructor
8+ */
9+function MoveSummary () {
10+ this.moves = [];
11+ this.sources = {};
12+}
13+
14+MoveSummary.SUMMARY_REGEX = /^Renaming (.+) to (.+)$/;
15+
16+MoveSummary.parse = function (text) {
17+ var lines = text.split('\n');
18+ var summary = new MoveSummary();
19+
20+ for (var i = 0, iMax = lines.length, line; i < iMax; i++) {
21+ line = MoveSummary.SUMMARY_REGEX.exec(lines[i].trim());
22+
23+ if (line) {
24+ summary.moves.push({
25+ from: line[1],
26+ to: line[2]
27+ });
28+ }
29+ }
30+
31+ return summary;
32+};