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/BranchDeleteSummary.js (1 of 41 files). Show all

Unified · Split

node_modules/simple-git/src/responses/BranchDeleteSummary.js+26−0
@@ -0,0 +1,26 @@
1+
2+module.exports = BranchDeletion;
3+
4+function BranchDeletion (branch, hash) {
5+ this.branch = branch;
6+ this.hash = hash;
7+ this.success = hash !== null;
8+}
9+
10+BranchDeletion.deleteSuccessRegex = /(\S+)\s+\(\S+\s([^\)]+)\)/;
11+BranchDeletion.deleteErrorRegex = /^error[^']+'([^']+)'/;
12+
13+BranchDeletion.parse = function (data, asArray) {
14+ var result;
15+ var branchDeletions = data.trim().split('\n').map(function (line) {
16+ if (result = BranchDeletion.deleteSuccessRegex.exec(line)) {
17+ return new BranchDeletion(result[1], result[2]);
18+ }
19+ else if (result = BranchDeletion.deleteErrorRegex.exec(line)) {
20+ return new BranchDeletion(result[1], null);
21+ }
22+ })
23+ .filter(Boolean);
24+
25+ return asArray ? branchDeletions : branchDeletions.pop();
26+};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t