@swimlane/nodegit 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/.dockerignore +2 -0
  2. package/.github/workflows/publish.yml +126 -0
  3. package/.github/workflows/tests.yml +85 -0
  4. package/LICENSE +19 -0
  5. package/README.md +193 -0
  6. package/lib/attr.js +20 -0
  7. package/lib/blob.js +51 -0
  8. package/lib/branch.js +19 -0
  9. package/lib/buf.js +43 -0
  10. package/lib/commit.js +437 -0
  11. package/lib/config.js +48 -0
  12. package/lib/convenient_hunks.js +61 -0
  13. package/lib/convenient_patch.js +131 -0
  14. package/lib/credential.js +33 -0
  15. package/lib/deprecated/structs/ApplyOptions.js +3 -0
  16. package/lib/deprecated/structs/BlameOptions.js +6 -0
  17. package/lib/deprecated/structs/BlobFilterOptions.js +3 -0
  18. package/lib/deprecated/structs/CheckoutOptions.js +8 -0
  19. package/lib/deprecated/structs/CherrypickOptions.js +5 -0
  20. package/lib/deprecated/structs/CloneOptions.js +6 -0
  21. package/lib/deprecated/structs/DescribeFormatOptions.js +4 -0
  22. package/lib/deprecated/structs/DescribeOptions.js +6 -0
  23. package/lib/deprecated/structs/DiffFindOptions.js +8 -0
  24. package/lib/deprecated/structs/DiffOptions.js +8 -0
  25. package/lib/deprecated/structs/FetchOptions.js +7 -0
  26. package/lib/deprecated/structs/MergeFileInput.js +4 -0
  27. package/lib/deprecated/structs/MergeFileOptions.js +5 -0
  28. package/lib/deprecated/structs/MergeOptions.js +8 -0
  29. package/lib/deprecated/structs/ProxyOptions.js +3 -0
  30. package/lib/deprecated/structs/PushOptions.js +5 -0
  31. package/lib/deprecated/structs/RebaseOptions.js +6 -0
  32. package/lib/deprecated/structs/RemoteCreateOptions.js +3 -0
  33. package/lib/deprecated/structs/RepositoryInitOptions.js +4 -0
  34. package/lib/deprecated/structs/RevertOptions.js +5 -0
  35. package/lib/deprecated/structs/StashApplyOptions.js +4 -0
  36. package/lib/deprecated/structs/StatusOptions.js +4 -0
  37. package/lib/deprecated/structs/SubmoduleUpdateOptions.js +5 -0
  38. package/lib/diff.js +67 -0
  39. package/lib/diff_file.js +38 -0
  40. package/lib/diff_line.js +32 -0
  41. package/lib/error.js +17 -0
  42. package/lib/filter_registry.js +22 -0
  43. package/lib/graph.js +15 -0
  44. package/lib/index.js +103 -0
  45. package/lib/merge.js +41 -0
  46. package/lib/note.js +17 -0
  47. package/lib/object.js +45 -0
  48. package/lib/odb_object.js +9 -0
  49. package/lib/oid.js +23 -0
  50. package/lib/rebase.js +86 -0
  51. package/lib/reference.js +213 -0
  52. package/lib/remote.js +45 -0
  53. package/lib/repository.js +1973 -0
  54. package/lib/reset.js +51 -0
  55. package/lib/revparse.js +18 -0
  56. package/lib/revwalk.js +142 -0
  57. package/lib/signature.js +38 -0
  58. package/lib/stash.js +16 -0
  59. package/lib/status.js +16 -0
  60. package/lib/status_file.js +106 -0
  61. package/lib/submodule.js +10 -0
  62. package/lib/tag.js +141 -0
  63. package/lib/tree.js +175 -0
  64. package/lib/tree_entry.js +99 -0
  65. package/lib/utils/lookup_wrapper.js +39 -0
  66. package/lib/utils/shallow_clone.js +14 -0
  67. package/lifecycleScripts/clean.js +5 -0
  68. package/lifecycleScripts/install.js +32 -0
  69. package/lifecycleScripts/postinstall.js +83 -0
  70. package/lifecycleScripts/preinstall.js +47 -0
  71. package/lifecycleScripts/submodules/getStatus.js +50 -0
  72. package/lifecycleScripts/submodules/index.js +84 -0
  73. package/package.json +83 -0
  74. package/prebuilds/darwin-arm64/@swimlane+nodegit.glibc.node +0 -0
  75. package/prebuilds/darwin-x64/@swimlane+nodegit.glibc.node +0 -0
  76. package/prebuilds/linux-arm64/@swimlane+nodegit.glibc.node +0 -0
  77. package/prebuilds/linux-x64/@swimlane+nodegit.glibc.node +0 -0
  78. package/prebuilds/linux-x64/@swimlane+nodegit.musl.node +0 -0
  79. package/scripts/Dockerfile.alpine +10 -0
  80. package/scripts/Dockerfile.debian +15 -0
  81. package/utils/acquireOpenSSL.js +436 -0
  82. package/utils/build-openssl.bat +13 -0
  83. package/utils/buildFlags.js +19 -0
  84. package/utils/configureLibssh2.js +54 -0
  85. package/utils/defaultCxxStandard.js +18 -0
  86. package/utils/execPromise.js +24 -0
  87. package/utils/getElectronOpenSSLRoot.js +10 -0
  88. package/utils/gitExecutableLocation.js +23 -0
  89. package/utils/isBuildingForElectron.js +30 -0
  90. package/utils/retry.js +51 -0
@@ -0,0 +1,10 @@
1
+ const path = require("path");
2
+
3
+ if (process.argv.length < 3) {
4
+ process.exit(1);
5
+ }
6
+
7
+ const [, , moduleRootDir] = process.argv;
8
+
9
+ const openSSLRoot = process.env.npm_config_openssl_dir || path.join(moduleRootDir, 'vendor', 'openssl');
10
+ process.stdout.write(openSSLRoot);
@@ -0,0 +1,23 @@
1
+ var cp = require("child_process");
2
+
3
+ module.exports = function gitExecutableLocation() {
4
+ return new Promise(function(resolve, reject) {
5
+ var cmd;
6
+
7
+ if (process.platform === "win32") {
8
+ cmd = "where git";
9
+ }
10
+ else {
11
+ cmd = "which git";
12
+ }
13
+
14
+ cp.exec(cmd, function(err, stdout, stderr) {
15
+ if (err) {
16
+ reject(err, stderr);
17
+ }
18
+ else {
19
+ resolve(stdout);
20
+ }
21
+ });
22
+ });
23
+ };
@@ -0,0 +1,30 @@
1
+ const fs = require("fs")
2
+ const JSON5 = require("json5");
3
+ const path = require("path");
4
+
5
+ if (process.argv.length < 3) {
6
+ process.exit(1);
7
+ }
8
+
9
+ const last = arr => arr[arr.length - 1];
10
+ const [, , nodeRootDir] = process.argv;
11
+
12
+ let isElectron = last(nodeRootDir.split(path.sep)).startsWith("iojs");
13
+
14
+ if (!isElectron) {
15
+ try {
16
+ // Not ideal, would love it if there were a full featured gyp package to do this operation instead.
17
+ const { variables: { built_with_electron } } = JSON5.parse(
18
+ fs.readFileSync(
19
+ path.resolve(nodeRootDir, "include", "node", "config.gypi"),
20
+ "utf8"
21
+ )
22
+ );
23
+
24
+ if (built_with_electron) {
25
+ isElectron = true;
26
+ }
27
+ } catch (e) {}
28
+ }
29
+
30
+ process.stdout.write(isElectron ? "1" : "0");
package/utils/retry.js ADDED
@@ -0,0 +1,51 @@
1
+ const { spawn } = require('child_process');
2
+
3
+ const [, , cmd, ...args] = process.argv;
4
+ if (!cmd) {
5
+ process.exit(-1);
6
+ }
7
+
8
+ const once = (fn) => {
9
+ let runOnce = false;
10
+ return (...args) => {
11
+ if (runOnce) {
12
+ return;
13
+ }
14
+
15
+ runOnce = true;
16
+ fn(...args);
17
+ }
18
+ };
19
+
20
+ const retry = (numRetries = 3) => {
21
+ const child = spawn(cmd, args, {
22
+ shell: process.platform === 'win32',
23
+ stdio: [0, 'pipe', 'pipe']
24
+ });
25
+
26
+ child.setMaxListeners(0);
27
+
28
+ child.stdout.setEncoding('utf8');
29
+ child.stderr.setEncoding('utf8');
30
+
31
+ child.stdout.pipe(process.stdout);
32
+ child.stderr.pipe(process.stderr);
33
+
34
+ const cleanupAndExit = once((error, status) => {
35
+ child.kill();
36
+ if (numRetries > 0 && (error || status !== 0)) {
37
+ retry(numRetries - 1);
38
+ } else if (error) {
39
+ console.log(error);
40
+ process.exit(-1);
41
+ } else {
42
+ process.exit(status);
43
+ }
44
+ });
45
+ const onClose = status => cleanupAndExit(null, status);
46
+
47
+ child.on('close', onClose);
48
+ child.on('error', cleanupAndExit);
49
+ };
50
+
51
+ retry();