pj-nodegit 0.18.4 → 0.18.5

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 (49) hide show
  1. package/lib/README.md +3 -0
  2. package/lib/attr.js +20 -0
  3. package/lib/blame.js +20 -0
  4. package/lib/blob.js +73 -0
  5. package/lib/branch.js +19 -0
  6. package/lib/buf.js +11 -0
  7. package/lib/checkout.js +51 -0
  8. package/lib/cherrypick.js +73 -0
  9. package/lib/clone.js +33 -0
  10. package/lib/commit.js +437 -0
  11. package/lib/config.js +25 -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/diff.js +113 -0
  16. package/lib/diff_file.js +38 -0
  17. package/lib/diff_line.js +32 -0
  18. package/lib/enums.js +689 -0
  19. package/lib/error.js +17 -0
  20. package/lib/filter_registry.js +25 -0
  21. package/lib/index.js +103 -0
  22. package/lib/libgit2.js +6 -0
  23. package/lib/merge.js +72 -0
  24. package/lib/nodegit.js +1333 -0
  25. package/lib/note.js +17 -0
  26. package/lib/object.js +45 -0
  27. package/lib/odb_object.js +9 -0
  28. package/lib/oid.js +23 -0
  29. package/lib/rebase.js +142 -0
  30. package/lib/reference.js +213 -0
  31. package/lib/remote.js +270 -0
  32. package/lib/repository.js +1982 -0
  33. package/lib/reset.js +76 -0
  34. package/lib/revert.js +77 -0
  35. package/lib/revwalk.js +142 -0
  36. package/lib/signature.js +38 -0
  37. package/lib/stash.js +62 -0
  38. package/lib/status.js +18 -0
  39. package/lib/status_file.js +106 -0
  40. package/lib/status_list.js +12 -0
  41. package/lib/submodule.js +51 -0
  42. package/lib/tag.js +135 -0
  43. package/lib/tree.js +175 -0
  44. package/lib/tree_entry.js +99 -0
  45. package/lib/utils/lookup_wrapper.js +39 -0
  46. package/lib/utils/normalize_fetch_options.js +43 -0
  47. package/lib/utils/normalize_options.js +29 -0
  48. package/lib/utils/shallow_clone.js +14 -0
  49. package/package.json +1 -1
package/lib/diff.js ADDED
@@ -0,0 +1,113 @@
1
+ var NodeGit = require("../");
2
+ var Diff = NodeGit.Diff;
3
+ var normalizeOptions = NodeGit.Utils.normalizeOptions;
4
+ var Patch = NodeGit.Patch;
5
+
6
+ var _blobToBuffer = Diff.blobToBuffer;
7
+ var _indexToWorkdir = Diff.indexToWorkdir;
8
+ var _treeToIndex = Diff.treeToIndex;
9
+ var _treeToTree = Diff.treeToTree;
10
+ var _treeToWorkdir = Diff.treeToWorkdir;
11
+ var _treeToWorkdirWithIndex = Diff.treeToWorkdirWithIndex;
12
+
13
+ var _findSimilar = Diff.prototype.findSimilar;
14
+
15
+ /**
16
+ * Directly run a diff between a blob and a buffer.
17
+ * @async
18
+ * @param {Blob} old_blob Blob for old side of diff, or NULL for empty blob
19
+ * @param {String} old_as_path Treat old blob as if it had this filename;
20
+ * can be NULL
21
+ * @param {String} buffer Raw data for new side of diff, or NULL for empty
22
+ * @param {String} buffer_as_path Treat buffer as if it had this filename;
23
+ * can be NULL
24
+ * @param {DiffOptions} opts Options for diff, or NULL for default options
25
+ * @param {Function} file_cb Callback for "file"; made once if there is a diff;
26
+ * can be NULL
27
+ * @param {Function} binary_cb Callback for binary files; can be NULL
28
+ * @param {Function} hunk_cb Callback for each hunk in diff; can be NULL
29
+ * @param {Function} line_cb Callback for each line in diff; can be NULL
30
+ */
31
+ Diff.blobToBuffer= function(
32
+ old_blob,
33
+ old_as_path,
34
+ buffer,
35
+ buffer_as_path,
36
+ opts,
37
+ file_cb,
38
+ binary_cb,
39
+ hunk_cb,
40
+ line_cb) {
41
+ var bufferText;
42
+ var bufferLength;
43
+ if (buffer instanceof Buffer) {
44
+ bufferText = buffer.toString("utf8");
45
+ bufferLength = Buffer.byteLength(buffer, "utf8");
46
+ } else {
47
+ bufferText = buffer;
48
+ bufferLength = !buffer ? 0 : Buffer.byteLength(buffer, "utf8");
49
+ }
50
+
51
+ opts = normalizeOptions(opts, NodeGit.DiffOptions);
52
+
53
+ return _blobToBuffer.call(
54
+ this,
55
+ old_blob,
56
+ old_as_path,
57
+ bufferText,
58
+ bufferLength,
59
+ buffer_as_path,
60
+ opts,
61
+ file_cb,
62
+ binary_cb,
63
+ hunk_cb,
64
+ line_cb,
65
+ null);
66
+ };
67
+
68
+ // Override Diff.indexToWorkdir to normalize opts
69
+ Diff.indexToWorkdir = function(repo, index, opts) {
70
+ opts = normalizeOptions(opts, NodeGit.DiffOptions);
71
+ return _indexToWorkdir(repo, index, opts);
72
+ };
73
+
74
+ // Override Diff.treeToIndex to normalize opts
75
+ Diff.treeToIndex = function(repo, tree, index, opts) {
76
+ opts = normalizeOptions(opts, NodeGit.DiffOptions);
77
+ return _treeToIndex(repo, tree, index, opts);
78
+ };
79
+
80
+ // Override Diff.treeToTree to normalize opts
81
+ Diff.treeToTree = function(repo, from_tree, to_tree, opts) {
82
+ opts = normalizeOptions(opts, NodeGit.DiffOptions);
83
+ return _treeToTree(repo, from_tree, to_tree, opts);
84
+ };
85
+
86
+ // Override Diff.treeToWorkdir to normalize opts
87
+ Diff.treeToWorkdir = function(repo, tree, opts) {
88
+ opts = normalizeOptions(opts, NodeGit.DiffOptions);
89
+ return _treeToWorkdir(repo, tree, opts);
90
+ };
91
+
92
+ // Override Diff.treeToWorkdir to normalize opts
93
+ Diff.treeToWorkdirWithIndex = function(repo, tree, opts) {
94
+ opts = normalizeOptions(opts, NodeGit.DiffOptions);
95
+ return _treeToWorkdirWithIndex(repo, tree, opts);
96
+ };
97
+
98
+ // Override Diff.findSimilar to normalize opts
99
+ Diff.prototype.findSimilar = function(opts) {
100
+ opts = normalizeOptions(opts, NodeGit.DiffFindOptions);
101
+ return _findSimilar.call(this, opts);
102
+ };
103
+
104
+ /**
105
+ * Retrieve patches in this difflist
106
+ *
107
+ * @async
108
+ * @return {Array<ConvenientPatch>} a promise that resolves to an array of
109
+ * ConvenientPatches
110
+ */
111
+ Diff.prototype.patches = function() {
112
+ return Patch.convenientFromDiff(this);
113
+ };
@@ -0,0 +1,38 @@
1
+ var NodeGit = require("../");
2
+
3
+ var DiffFile = NodeGit.DiffFile;
4
+
5
+ var flags = DiffFile.prototype.flags;
6
+ /**
7
+ * Returns the file's flags
8
+ * @return {Number}
9
+ */
10
+ DiffFile.prototype.flags = flags;
11
+
12
+ var id = DiffFile.prototype.id;
13
+ /**
14
+ * Returns the file's Oid
15
+ * @return {Oid}
16
+ */
17
+ DiffFile.prototype.id = id;
18
+
19
+ var mode = DiffFile.prototype.mode;
20
+ /**
21
+ * Returns the file's mode
22
+ * @return {Number}
23
+ */
24
+ DiffFile.prototype.mode = mode;
25
+
26
+ var path = DiffFile.prototype.path;
27
+ /**
28
+ * Returns the file's path
29
+ * @return {String}
30
+ */
31
+ DiffFile.prototype.path = path;
32
+
33
+ var size = DiffFile.prototype.size;
34
+ /**
35
+ * Returns the file's size
36
+ * @return {Number}
37
+ */
38
+ DiffFile.prototype.size = size;
@@ -0,0 +1,32 @@
1
+ var NodeGit = require("../");
2
+ var DiffLine = NodeGit.DiffLine;
3
+
4
+ var _rawContent = DiffLine.prototype.content;
5
+
6
+ /**
7
+ * The relevant line
8
+ * @return {String}
9
+ */
10
+ DiffLine.prototype.content = function() {
11
+ if (!this._cache) {
12
+ this._cache = {};
13
+ }
14
+
15
+ if (!this._cache.content) {
16
+ this._cache.content = Buffer.from(this.rawContent())
17
+ .slice(0, this.contentLen())
18
+ .toString("utf8");
19
+ }
20
+
21
+ return this._cache.content;
22
+ };
23
+
24
+ /**
25
+ * The non utf8 translated text
26
+ * @return {String}
27
+ */
28
+ DiffLine.prototype.rawContent = function() {
29
+ return _rawContent.call(this);
30
+ };
31
+
32
+ NodeGit.DiffLine = DiffLine;