isomorphic-git 1.7.6 → 1.8.1
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.
- package/README.md +4 -1
- package/browser-tests.json +4 -5
- package/{cli.js → cli.cjs} +0 -0
- package/index.cjs +141 -51
- package/index.d.ts +93 -31
- package/index.js +141 -51
- package/index.umd.min.d.ts +93 -31
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/package.json +3 -3
- package/size_report.html +1 -1
package/index.cjs
CHANGED
|
@@ -807,6 +807,8 @@ function compareStats(entry, stats) {
|
|
|
807
807
|
// const lm = new LockManager()
|
|
808
808
|
let lock = null;
|
|
809
809
|
|
|
810
|
+
const IndexCache = Symbol('IndexCache');
|
|
811
|
+
|
|
810
812
|
function createCache() {
|
|
811
813
|
return {
|
|
812
814
|
map: new Map(),
|
|
@@ -844,7 +846,7 @@ class GitIndexManager {
|
|
|
844
846
|
* @param {function(GitIndex): any} closure
|
|
845
847
|
*/
|
|
846
848
|
static async acquire({ fs, gitdir, cache }, closure) {
|
|
847
|
-
if (!cache
|
|
849
|
+
if (!cache[IndexCache]) cache[IndexCache] = createCache();
|
|
848
850
|
|
|
849
851
|
const filepath = `${gitdir}/index`;
|
|
850
852
|
if (lock === null) lock = new AsyncLock({ maxPending: Infinity });
|
|
@@ -854,10 +856,10 @@ class GitIndexManager {
|
|
|
854
856
|
// to make sure other processes aren't writing to it
|
|
855
857
|
// simultaneously, which could result in a corrupted index.
|
|
856
858
|
// const fileLock = await Lock(filepath)
|
|
857
|
-
if (await isIndexStale(fs, filepath, cache
|
|
858
|
-
await updateCachedIndexFile(fs, filepath, cache
|
|
859
|
+
if (await isIndexStale(fs, filepath, cache[IndexCache])) {
|
|
860
|
+
await updateCachedIndexFile(fs, filepath, cache[IndexCache]);
|
|
859
861
|
}
|
|
860
|
-
const index = cache.
|
|
862
|
+
const index = cache[IndexCache].map.get(filepath);
|
|
861
863
|
result = await closure(index);
|
|
862
864
|
if (index._dirty) {
|
|
863
865
|
// Acquire a file lock while we're writing the index file
|
|
@@ -865,7 +867,7 @@ class GitIndexManager {
|
|
|
865
867
|
const buffer = await index.toObject();
|
|
866
868
|
await fs.write(filepath, buffer);
|
|
867
869
|
// Update cached stat value
|
|
868
|
-
cache.
|
|
870
|
+
cache[IndexCache].stats.set(filepath, await fs.lstat(filepath));
|
|
869
871
|
index._dirty = false;
|
|
870
872
|
}
|
|
871
873
|
});
|
|
@@ -2813,6 +2815,8 @@ class GitPackIndex {
|
|
|
2813
2815
|
}
|
|
2814
2816
|
}
|
|
2815
2817
|
|
|
2818
|
+
const PackfileCache = Symbol('PackfileCache');
|
|
2819
|
+
|
|
2816
2820
|
async function loadPackIndex({
|
|
2817
2821
|
fs,
|
|
2818
2822
|
filename,
|
|
@@ -2833,8 +2837,8 @@ function readPackIndex({
|
|
|
2833
2837
|
emitterPrefix,
|
|
2834
2838
|
}) {
|
|
2835
2839
|
// Try to get the packfile index from the in-memory cache
|
|
2836
|
-
if (!cache
|
|
2837
|
-
let p = cache.
|
|
2840
|
+
if (!cache[PackfileCache]) cache[PackfileCache] = new Map();
|
|
2841
|
+
let p = cache[PackfileCache].get(filename);
|
|
2838
2842
|
if (!p) {
|
|
2839
2843
|
p = loadPackIndex({
|
|
2840
2844
|
fs,
|
|
@@ -2843,7 +2847,7 @@ function readPackIndex({
|
|
|
2843
2847
|
emitter,
|
|
2844
2848
|
emitterPrefix,
|
|
2845
2849
|
});
|
|
2846
|
-
cache.
|
|
2850
|
+
cache[PackfileCache].set(filename, p);
|
|
2847
2851
|
}
|
|
2848
2852
|
return p
|
|
2849
2853
|
}
|
|
@@ -3685,9 +3689,9 @@ async function resolveTree({ fs, cache, gitdir, oid }) {
|
|
|
3685
3689
|
}
|
|
3686
3690
|
|
|
3687
3691
|
class GitWalkerRepo {
|
|
3688
|
-
constructor({ fs, gitdir, ref }) {
|
|
3692
|
+
constructor({ fs, gitdir, ref, cache }) {
|
|
3689
3693
|
this.fs = fs;
|
|
3690
|
-
this.cache =
|
|
3694
|
+
this.cache = cache;
|
|
3691
3695
|
this.gitdir = gitdir;
|
|
3692
3696
|
this.mapPromise = (async () => {
|
|
3693
3697
|
const map = new Map();
|
|
@@ -3819,8 +3823,8 @@ class GitWalkerRepo {
|
|
|
3819
3823
|
function TREE({ ref = 'HEAD' }) {
|
|
3820
3824
|
const o = Object.create(null);
|
|
3821
3825
|
Object.defineProperty(o, GitWalkSymbol, {
|
|
3822
|
-
value: function({ fs, gitdir }) {
|
|
3823
|
-
return new GitWalkerRepo({ fs, gitdir, ref })
|
|
3826
|
+
value: function({ fs, gitdir, cache }) {
|
|
3827
|
+
return new GitWalkerRepo({ fs, gitdir, ref, cache })
|
|
3824
3828
|
},
|
|
3825
3829
|
});
|
|
3826
3830
|
Object.freeze(o);
|
|
@@ -4291,6 +4295,8 @@ async function browserDeflate(buffer) {
|
|
|
4291
4295
|
function testCompressionStream() {
|
|
4292
4296
|
try {
|
|
4293
4297
|
const cs = new CompressionStream('deflate');
|
|
4298
|
+
// Test if `Blob.stream` is present. React Native does not have the `stream` method
|
|
4299
|
+
new Blob([]).stream();
|
|
4294
4300
|
if (cs) return true
|
|
4295
4301
|
} catch (_) {
|
|
4296
4302
|
// no bother
|
|
@@ -4336,6 +4342,7 @@ function assertParameter(name, value) {
|
|
|
4336
4342
|
* @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path
|
|
4337
4343
|
* @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
4338
4344
|
* @param {string} args.filepath - The path to the file to add to the index
|
|
4345
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
4339
4346
|
*
|
|
4340
4347
|
* @returns {Promise<void>} Resolves successfully once the git index has been updated
|
|
4341
4348
|
*
|
|
@@ -4350,6 +4357,7 @@ async function add({
|
|
|
4350
4357
|
dir,
|
|
4351
4358
|
gitdir = join(dir, '.git'),
|
|
4352
4359
|
filepath,
|
|
4360
|
+
cache = {},
|
|
4353
4361
|
}) {
|
|
4354
4362
|
try {
|
|
4355
4363
|
assertParameter('fs', _fs);
|
|
@@ -4358,7 +4366,6 @@ async function add({
|
|
|
4358
4366
|
assertParameter('filepath', filepath);
|
|
4359
4367
|
|
|
4360
4368
|
const fs = new FileSystem(_fs);
|
|
4361
|
-
const cache = {};
|
|
4362
4369
|
await GitIndexManager.acquire({ fs, gitdir, cache }, async function(index) {
|
|
4363
4370
|
await addToIndex({ dir, gitdir, fs, filepath, index });
|
|
4364
4371
|
});
|
|
@@ -4855,6 +4862,7 @@ async function normalizeCommitterObject({
|
|
|
4855
4862
|
* @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).
|
|
4856
4863
|
* @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.
|
|
4857
4864
|
* @param {string} [args.signingKey] - Sign the note commit using this private PGP key.
|
|
4865
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
4858
4866
|
*
|
|
4859
4867
|
* @returns {Promise<string>} Resolves successfully with the SHA-1 object id of the commit object for the added note.
|
|
4860
4868
|
*/
|
|
@@ -4871,6 +4879,7 @@ async function addNote({
|
|
|
4871
4879
|
author: _author,
|
|
4872
4880
|
committer: _committer,
|
|
4873
4881
|
signingKey,
|
|
4882
|
+
cache = {},
|
|
4874
4883
|
}) {
|
|
4875
4884
|
try {
|
|
4876
4885
|
assertParameter('fs', _fs);
|
|
@@ -4881,7 +4890,6 @@ async function addNote({
|
|
|
4881
4890
|
assertParameter('onSign', onSign);
|
|
4882
4891
|
}
|
|
4883
4892
|
const fs = new FileSystem(_fs);
|
|
4884
|
-
const cache = {};
|
|
4885
4893
|
|
|
4886
4894
|
const author = await normalizeAuthorObject({ fs, gitdir, author: _author });
|
|
4887
4895
|
if (!author) throw new MissingNameError('author')
|
|
@@ -5107,6 +5115,7 @@ async function _annotatedTag({
|
|
|
5107
5115
|
* @param {string} [args.gpgsig] - The gpgsig attatched to the tag object. (Mutually exclusive with the `signingKey` option.)
|
|
5108
5116
|
* @param {string} [args.signingKey] - Sign the tag object using this private PGP key. (Mutually exclusive with the `gpgsig` option.)
|
|
5109
5117
|
* @param {boolean} [args.force = false] - Instead of throwing an error if a tag named `ref` already exists, overwrite the existing tag. Note that this option does not modify the original tag object itself.
|
|
5118
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
5110
5119
|
*
|
|
5111
5120
|
* @returns {Promise<void>} Resolves successfully when filesystem operations are complete
|
|
5112
5121
|
*
|
|
@@ -5136,6 +5145,7 @@ async function annotatedTag({
|
|
|
5136
5145
|
object,
|
|
5137
5146
|
signingKey,
|
|
5138
5147
|
force = false,
|
|
5148
|
+
cache = {},
|
|
5139
5149
|
}) {
|
|
5140
5150
|
try {
|
|
5141
5151
|
assertParameter('fs', _fs);
|
|
@@ -5152,7 +5162,7 @@ async function annotatedTag({
|
|
|
5152
5162
|
|
|
5153
5163
|
return await _annotatedTag({
|
|
5154
5164
|
fs,
|
|
5155
|
-
cache
|
|
5165
|
+
cache,
|
|
5156
5166
|
onSign,
|
|
5157
5167
|
gitdir,
|
|
5158
5168
|
ref,
|
|
@@ -6019,6 +6029,7 @@ async function analyze({
|
|
|
6019
6029
|
* @param {boolean} [args.noUpdateHead] - If true, will update the working directory but won't update HEAD. Defaults to `false` when `ref` is provided, and `true` if `ref` is not provided.
|
|
6020
6030
|
* @param {boolean} [args.dryRun = false] - If true, simulates a checkout so you can test whether it would succeed.
|
|
6021
6031
|
* @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.
|
|
6032
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
6022
6033
|
*
|
|
6023
6034
|
* @returns {Promise<void>} Resolves successfully when filesystem operations are complete
|
|
6024
6035
|
*
|
|
@@ -6065,6 +6076,7 @@ async function checkout({
|
|
|
6065
6076
|
noUpdateHead = _ref === undefined,
|
|
6066
6077
|
dryRun = false,
|
|
6067
6078
|
force = false,
|
|
6079
|
+
cache = {},
|
|
6068
6080
|
}) {
|
|
6069
6081
|
try {
|
|
6070
6082
|
assertParameter('fs', fs);
|
|
@@ -6074,7 +6086,7 @@ async function checkout({
|
|
|
6074
6086
|
const ref = _ref || 'HEAD';
|
|
6075
6087
|
return await _checkout({
|
|
6076
6088
|
fs: new FileSystem(fs),
|
|
6077
|
-
cache
|
|
6089
|
+
cache,
|
|
6078
6090
|
onProgress,
|
|
6079
6091
|
dir,
|
|
6080
6092
|
gitdir,
|
|
@@ -6439,7 +6451,7 @@ class GitRemoteHTTP {
|
|
|
6439
6451
|
* @param {string} [args.corsProxy]
|
|
6440
6452
|
* @param {string} args.service
|
|
6441
6453
|
* @param {string} args.url
|
|
6442
|
-
* @param {Object<string, string>}
|
|
6454
|
+
* @param {Object<string, string>} args.headers
|
|
6443
6455
|
* @param {1 | 2} args.protocolVersion - Git Protocol Version
|
|
6444
6456
|
*/
|
|
6445
6457
|
static async discover({
|
|
@@ -6759,8 +6771,8 @@ function filterCapabilities(server, client) {
|
|
|
6759
6771
|
|
|
6760
6772
|
const pkg = {
|
|
6761
6773
|
name: 'isomorphic-git',
|
|
6762
|
-
version: '1.
|
|
6763
|
-
agent: 'git/isomorphic-git@1.
|
|
6774
|
+
version: '1.8.1',
|
|
6775
|
+
agent: 'git/isomorphic-git@1.8.1',
|
|
6764
6776
|
};
|
|
6765
6777
|
|
|
6766
6778
|
class FIFO {
|
|
@@ -7168,6 +7180,7 @@ async function _fetch({
|
|
|
7168
7180
|
service: 'git-upload-pack',
|
|
7169
7181
|
url,
|
|
7170
7182
|
headers,
|
|
7183
|
+
protocolVersion: 1,
|
|
7171
7184
|
});
|
|
7172
7185
|
const auth = remoteHTTP.auth; // hack to get new credentials from CredentialManager API
|
|
7173
7186
|
const remoteRefs = remoteHTTP.refs;
|
|
@@ -7597,6 +7610,7 @@ async function _clone({
|
|
|
7597
7610
|
* @param {string[]} [args.exclude = []] - A list of branches or tags. Instructs the remote server not to send us any commits reachable from these refs.
|
|
7598
7611
|
* @param {boolean} [args.relative = false] - Changes the meaning of `depth` to be measured from the current shallow depth rather than from the branch tip.
|
|
7599
7612
|
* @param {Object<string, string>} [args.headers = {}] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config
|
|
7613
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
7600
7614
|
*
|
|
7601
7615
|
* @returns {Promise<void>} Resolves successfully when clone completes
|
|
7602
7616
|
*
|
|
@@ -7635,6 +7649,7 @@ async function clone({
|
|
|
7635
7649
|
noCheckout = false,
|
|
7636
7650
|
noTags = false,
|
|
7637
7651
|
headers = {},
|
|
7652
|
+
cache = {},
|
|
7638
7653
|
}) {
|
|
7639
7654
|
try {
|
|
7640
7655
|
assertParameter('fs', fs);
|
|
@@ -7647,7 +7662,7 @@ async function clone({
|
|
|
7647
7662
|
|
|
7648
7663
|
return await _clone({
|
|
7649
7664
|
fs: new FileSystem(fs),
|
|
7650
|
-
cache
|
|
7665
|
+
cache,
|
|
7651
7666
|
http,
|
|
7652
7667
|
onProgress,
|
|
7653
7668
|
onMessage,
|
|
@@ -7702,6 +7717,7 @@ async function clone({
|
|
|
7702
7717
|
* @param {string} [args.ref] - The fully expanded name of the branch to commit to. Default is the current branch pointed to by HEAD. (TODO: fix it so it can expand branch names without throwing if the branch doesn't exist yet.)
|
|
7703
7718
|
* @param {string[]} [args.parent] - The SHA-1 object ids of the commits to use as parents. If not specified, the commit pointed to by `ref` is used.
|
|
7704
7719
|
* @param {string} [args.tree] - The SHA-1 object id of the tree to use. If not specified, a new tree object is created from the current git index.
|
|
7720
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
7705
7721
|
*
|
|
7706
7722
|
* @returns {Promise<string>} Resolves successfully with the SHA-1 object id of the newly created commit.
|
|
7707
7723
|
*
|
|
@@ -7732,6 +7748,7 @@ async function commit({
|
|
|
7732
7748
|
ref,
|
|
7733
7749
|
parent,
|
|
7734
7750
|
tree,
|
|
7751
|
+
cache = {},
|
|
7735
7752
|
}) {
|
|
7736
7753
|
try {
|
|
7737
7754
|
assertParameter('fs', _fs);
|
|
@@ -7740,7 +7757,6 @@ async function commit({
|
|
|
7740
7757
|
assertParameter('onSign', onSign);
|
|
7741
7758
|
}
|
|
7742
7759
|
const fs = new FileSystem(_fs);
|
|
7743
|
-
const cache = {};
|
|
7744
7760
|
|
|
7745
7761
|
const author = await normalizeAuthorObject({ fs, gitdir, author: _author });
|
|
7746
7762
|
if (!author) throw new MissingNameError('author')
|
|
@@ -8096,6 +8112,7 @@ async function _expandOid({ fs, cache, gitdir, oid: short }) {
|
|
|
8096
8112
|
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
|
|
8097
8113
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
8098
8114
|
* @param {string} args.oid - The shortened oid prefix to expand (like "0414d2a")
|
|
8115
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
8099
8116
|
*
|
|
8100
8117
|
* @returns {Promise<string>} Resolves successfully with the full oid (like "0414d2a286d7bbc7a4a326a61c1f9f888a8ab87f")
|
|
8101
8118
|
*
|
|
@@ -8104,14 +8121,20 @@ async function _expandOid({ fs, cache, gitdir, oid: short }) {
|
|
|
8104
8121
|
* console.log(oid)
|
|
8105
8122
|
*
|
|
8106
8123
|
*/
|
|
8107
|
-
async function expandOid({
|
|
8124
|
+
async function expandOid({
|
|
8125
|
+
fs,
|
|
8126
|
+
dir,
|
|
8127
|
+
gitdir = join(dir, '.git'),
|
|
8128
|
+
oid,
|
|
8129
|
+
cache = {},
|
|
8130
|
+
}) {
|
|
8108
8131
|
try {
|
|
8109
8132
|
assertParameter('fs', fs);
|
|
8110
8133
|
assertParameter('gitdir', gitdir);
|
|
8111
8134
|
assertParameter('oid', oid);
|
|
8112
8135
|
return await _expandOid({
|
|
8113
8136
|
fs: new FileSystem(fs),
|
|
8114
|
-
cache
|
|
8137
|
+
cache,
|
|
8115
8138
|
gitdir,
|
|
8116
8139
|
oid,
|
|
8117
8140
|
})
|
|
@@ -8261,6 +8284,7 @@ function mergeFile({
|
|
|
8261
8284
|
*
|
|
8262
8285
|
* @param {Object} args
|
|
8263
8286
|
* @param {import('../models/FileSystem.js').FileSystem} args.fs
|
|
8287
|
+
* @param {object} args.cache
|
|
8264
8288
|
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
|
|
8265
8289
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
8266
8290
|
* @param {string} args.ourOid - The SHA-1 object id of our tree
|
|
@@ -8276,6 +8300,7 @@ function mergeFile({
|
|
|
8276
8300
|
*/
|
|
8277
8301
|
async function mergeTree({
|
|
8278
8302
|
fs,
|
|
8303
|
+
cache,
|
|
8279
8304
|
dir,
|
|
8280
8305
|
gitdir = join(dir, '.git'),
|
|
8281
8306
|
ourOid,
|
|
@@ -8292,6 +8317,7 @@ async function mergeTree({
|
|
|
8292
8317
|
|
|
8293
8318
|
const results = await _walk({
|
|
8294
8319
|
fs,
|
|
8320
|
+
cache,
|
|
8295
8321
|
dir,
|
|
8296
8322
|
gitdir,
|
|
8297
8323
|
trees: [ourTree, baseTree, theirTree],
|
|
@@ -8363,6 +8389,9 @@ async function mergeTree({
|
|
|
8363
8389
|
reduce: async (parent, children) => {
|
|
8364
8390
|
const entries = children.filter(Boolean); // remove undefineds
|
|
8365
8391
|
|
|
8392
|
+
// if the parent was deleted, the children have to go
|
|
8393
|
+
if (!parent) return
|
|
8394
|
+
|
|
8366
8395
|
// automatically delete directories if they have been emptied
|
|
8367
8396
|
if (parent && parent.type === 'tree' && entries.length === 0) return
|
|
8368
8397
|
|
|
@@ -8592,6 +8621,7 @@ async function _merge({
|
|
|
8592
8621
|
// try a fancier merge
|
|
8593
8622
|
const tree = await mergeTree({
|
|
8594
8623
|
fs,
|
|
8624
|
+
cache,
|
|
8595
8625
|
gitdir,
|
|
8596
8626
|
ourOid,
|
|
8597
8627
|
theirOid,
|
|
@@ -8770,6 +8800,7 @@ async function _pull({
|
|
|
8770
8800
|
* @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.
|
|
8771
8801
|
* @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.
|
|
8772
8802
|
* @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config
|
|
8803
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
8773
8804
|
*
|
|
8774
8805
|
* @returns {Promise<void>} Resolves successfully when pull operation completes
|
|
8775
8806
|
*
|
|
@@ -8801,6 +8832,7 @@ async function fastForward({
|
|
|
8801
8832
|
corsProxy,
|
|
8802
8833
|
singleBranch,
|
|
8803
8834
|
headers = {},
|
|
8835
|
+
cache = {},
|
|
8804
8836
|
}) {
|
|
8805
8837
|
try {
|
|
8806
8838
|
assertParameter('fs', fs);
|
|
@@ -8816,7 +8848,7 @@ async function fastForward({
|
|
|
8816
8848
|
|
|
8817
8849
|
return await _pull({
|
|
8818
8850
|
fs: new FileSystem(fs),
|
|
8819
|
-
cache
|
|
8851
|
+
cache,
|
|
8820
8852
|
http,
|
|
8821
8853
|
onProgress,
|
|
8822
8854
|
onMessage,
|
|
@@ -8882,6 +8914,7 @@ async function fastForward({
|
|
|
8882
8914
|
* @param {boolean} [args.pruneTags] - Prune local tags that don’t exist on the remote, and force-update those tags that differ
|
|
8883
8915
|
* @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.
|
|
8884
8916
|
* @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config
|
|
8917
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
8885
8918
|
*
|
|
8886
8919
|
* @returns {Promise<FetchResult>} Resolves successfully when fetch completes
|
|
8887
8920
|
* @see FetchResult
|
|
@@ -8925,6 +8958,7 @@ async function fetch({
|
|
|
8925
8958
|
headers = {},
|
|
8926
8959
|
prune = false,
|
|
8927
8960
|
pruneTags = false,
|
|
8961
|
+
cache = {},
|
|
8928
8962
|
}) {
|
|
8929
8963
|
try {
|
|
8930
8964
|
assertParameter('fs', fs);
|
|
@@ -8933,7 +8967,7 @@ async function fetch({
|
|
|
8933
8967
|
|
|
8934
8968
|
return await _fetch({
|
|
8935
8969
|
fs: new FileSystem(fs),
|
|
8936
|
-
cache
|
|
8970
|
+
cache,
|
|
8937
8971
|
http,
|
|
8938
8972
|
onProgress,
|
|
8939
8973
|
onMessage,
|
|
@@ -8972,6 +9006,7 @@ async function fetch({
|
|
|
8972
9006
|
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
|
|
8973
9007
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
8974
9008
|
* @param {string[]} args.oids - Which commits
|
|
9009
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
8975
9010
|
*
|
|
8976
9011
|
*/
|
|
8977
9012
|
async function findMergeBase({
|
|
@@ -8979,6 +9014,7 @@ async function findMergeBase({
|
|
|
8979
9014
|
dir,
|
|
8980
9015
|
gitdir = join(dir, '.git'),
|
|
8981
9016
|
oids,
|
|
9017
|
+
cache = {},
|
|
8982
9018
|
}) {
|
|
8983
9019
|
try {
|
|
8984
9020
|
assertParameter('fs', fs);
|
|
@@ -8987,7 +9023,7 @@ async function findMergeBase({
|
|
|
8987
9023
|
|
|
8988
9024
|
return await _findMergeBase({
|
|
8989
9025
|
fs: new FileSystem(fs),
|
|
8990
|
-
cache
|
|
9026
|
+
cache,
|
|
8991
9027
|
gitdir,
|
|
8992
9028
|
oids,
|
|
8993
9029
|
})
|
|
@@ -9530,6 +9566,7 @@ async function _indexPack({
|
|
|
9530
9566
|
* @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path
|
|
9531
9567
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
9532
9568
|
* @param {string} args.filepath - The path to the .pack file to index
|
|
9569
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
9533
9570
|
*
|
|
9534
9571
|
* @returns {Promise<{oids: string[]}>} Resolves with a list of the SHA-1 object ids contained in the packfile
|
|
9535
9572
|
*
|
|
@@ -9555,6 +9592,7 @@ async function indexPack({
|
|
|
9555
9592
|
dir,
|
|
9556
9593
|
gitdir = join(dir, '.git'),
|
|
9557
9594
|
filepath,
|
|
9595
|
+
cache = {},
|
|
9558
9596
|
}) {
|
|
9559
9597
|
try {
|
|
9560
9598
|
assertParameter('fs', fs);
|
|
@@ -9564,7 +9602,7 @@ async function indexPack({
|
|
|
9564
9602
|
|
|
9565
9603
|
return await _indexPack({
|
|
9566
9604
|
fs: new FileSystem(fs),
|
|
9567
|
-
cache
|
|
9605
|
+
cache,
|
|
9568
9606
|
onProgress,
|
|
9569
9607
|
dir,
|
|
9570
9608
|
gitdir,
|
|
@@ -9705,6 +9743,7 @@ async function _isDescendent({
|
|
|
9705
9743
|
* @param {string} args.oid - The descendent commit
|
|
9706
9744
|
* @param {string} args.ancestor - The (proposed) ancestor commit
|
|
9707
9745
|
* @param {number} [args.depth = -1] - Maximum depth to search before giving up. -1 means no maximum depth.
|
|
9746
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
9708
9747
|
*
|
|
9709
9748
|
* @returns {Promise<boolean>} Resolves to true if `oid` is a descendent of `ancestor`
|
|
9710
9749
|
*
|
|
@@ -9722,6 +9761,7 @@ async function isDescendent({
|
|
|
9722
9761
|
oid,
|
|
9723
9762
|
ancestor,
|
|
9724
9763
|
depth = -1,
|
|
9764
|
+
cache = {},
|
|
9725
9765
|
}) {
|
|
9726
9766
|
try {
|
|
9727
9767
|
assertParameter('fs', fs);
|
|
@@ -9731,7 +9771,7 @@ async function isDescendent({
|
|
|
9731
9771
|
|
|
9732
9772
|
return await _isDescendent({
|
|
9733
9773
|
fs: new FileSystem(fs),
|
|
9734
|
-
cache
|
|
9774
|
+
cache,
|
|
9735
9775
|
gitdir,
|
|
9736
9776
|
oid,
|
|
9737
9777
|
ancestor,
|
|
@@ -9862,6 +9902,7 @@ async function accumulateFilesFromOid({
|
|
|
9862
9902
|
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
|
|
9863
9903
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
9864
9904
|
* @param {string} [args.ref] - Return a list of all the files in the commit at `ref` instead of the files currently in the git index (aka staging area)
|
|
9905
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
9865
9906
|
*
|
|
9866
9907
|
* @returns {Promise<Array<string>>} Resolves successfully with an array of filepaths
|
|
9867
9908
|
*
|
|
@@ -9874,14 +9915,20 @@ async function accumulateFilesFromOid({
|
|
|
9874
9915
|
* console.log(files)
|
|
9875
9916
|
*
|
|
9876
9917
|
*/
|
|
9877
|
-
async function listFiles({
|
|
9918
|
+
async function listFiles({
|
|
9919
|
+
fs,
|
|
9920
|
+
dir,
|
|
9921
|
+
gitdir = join(dir, '.git'),
|
|
9922
|
+
ref,
|
|
9923
|
+
cache = {},
|
|
9924
|
+
}) {
|
|
9878
9925
|
try {
|
|
9879
9926
|
assertParameter('fs', fs);
|
|
9880
9927
|
assertParameter('gitdir', gitdir);
|
|
9881
9928
|
|
|
9882
9929
|
return await _listFiles({
|
|
9883
9930
|
fs: new FileSystem(fs),
|
|
9884
|
-
cache
|
|
9931
|
+
cache,
|
|
9885
9932
|
gitdir,
|
|
9886
9933
|
ref,
|
|
9887
9934
|
})
|
|
@@ -9942,6 +9989,7 @@ async function _listNotes({ fs, cache, gitdir, ref }) {
|
|
|
9942
9989
|
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
|
|
9943
9990
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
9944
9991
|
* @param {string} [args.ref] - The notes ref to look under
|
|
9992
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
9945
9993
|
*
|
|
9946
9994
|
* @returns {Promise<Array<{target: string, note: string}>>} Resolves successfully with an array of entries containing SHA-1 object ids of the note and the object the note targets
|
|
9947
9995
|
*/
|
|
@@ -9951,6 +9999,7 @@ async function listNotes({
|
|
|
9951
9999
|
dir,
|
|
9952
10000
|
gitdir = join(dir, '.git'),
|
|
9953
10001
|
ref = 'refs/notes/commits',
|
|
10002
|
+
cache = {},
|
|
9954
10003
|
}) {
|
|
9955
10004
|
try {
|
|
9956
10005
|
assertParameter('fs', fs);
|
|
@@ -9959,7 +10008,7 @@ async function listNotes({
|
|
|
9959
10008
|
|
|
9960
10009
|
return await _listNotes({
|
|
9961
10010
|
fs: new FileSystem(fs),
|
|
9962
|
-
cache
|
|
10011
|
+
cache,
|
|
9963
10012
|
gitdir,
|
|
9964
10013
|
ref,
|
|
9965
10014
|
})
|
|
@@ -10385,6 +10434,7 @@ async function _log({ fs, cache, gitdir, ref, depth, since }) {
|
|
|
10385
10434
|
* @param {string} [args.ref = 'HEAD'] - The commit to begin walking backwards through the history from
|
|
10386
10435
|
* @param {number} [args.depth] - Limit the number of commits returned. No limit by default.
|
|
10387
10436
|
* @param {Date} [args.since] - Return history newer than the given date. Can be combined with `depth` to get whichever is shorter.
|
|
10437
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
10388
10438
|
*
|
|
10389
10439
|
* @returns {Promise<Array<ReadCommitResult>>} Resolves to an array of ReadCommitResult objects
|
|
10390
10440
|
* @see ReadCommitResult
|
|
@@ -10407,6 +10457,7 @@ async function log({
|
|
|
10407
10457
|
ref = 'HEAD',
|
|
10408
10458
|
depth,
|
|
10409
10459
|
since, // Date
|
|
10460
|
+
cache = {},
|
|
10410
10461
|
}) {
|
|
10411
10462
|
try {
|
|
10412
10463
|
assertParameter('fs', fs);
|
|
@@ -10415,7 +10466,7 @@ async function log({
|
|
|
10415
10466
|
|
|
10416
10467
|
return await _log({
|
|
10417
10468
|
fs: new FileSystem(fs),
|
|
10418
|
-
cache
|
|
10469
|
+
cache,
|
|
10419
10470
|
gitdir,
|
|
10420
10471
|
ref,
|
|
10421
10472
|
depth,
|
|
@@ -10474,6 +10525,7 @@ async function log({
|
|
|
10474
10525
|
* @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).
|
|
10475
10526
|
* @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.
|
|
10476
10527
|
* @param {string} [args.signingKey] - passed to [commit](commit.md) when creating a merge commit
|
|
10528
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
10477
10529
|
*
|
|
10478
10530
|
* @returns {Promise<MergeResult>} Resolves to a description of the merge operation
|
|
10479
10531
|
* @see MergeResult
|
|
@@ -10502,6 +10554,7 @@ async function merge({
|
|
|
10502
10554
|
author: _author,
|
|
10503
10555
|
committer: _committer,
|
|
10504
10556
|
signingKey,
|
|
10557
|
+
cache = {},
|
|
10505
10558
|
}) {
|
|
10506
10559
|
try {
|
|
10507
10560
|
assertParameter('fs', _fs);
|
|
@@ -10509,7 +10562,6 @@ async function merge({
|
|
|
10509
10562
|
assertParameter('onSign', onSign);
|
|
10510
10563
|
}
|
|
10511
10564
|
const fs = new FileSystem(_fs);
|
|
10512
|
-
const cache = {};
|
|
10513
10565
|
|
|
10514
10566
|
const author = await normalizeAuthorObject({ fs, gitdir, author: _author });
|
|
10515
10567
|
if (!author && !fastForwardOnly) throw new MissingNameError('author')
|
|
@@ -10630,6 +10682,7 @@ async function _pack({
|
|
|
10630
10682
|
/**
|
|
10631
10683
|
* @param {object} args
|
|
10632
10684
|
* @param {import('../models/FileSystem.js').FileSystem} args.fs
|
|
10685
|
+
* @param {any} args.cache
|
|
10633
10686
|
* @param {string} args.gitdir
|
|
10634
10687
|
* @param {string[]} args.oids
|
|
10635
10688
|
* @param {boolean} args.write
|
|
@@ -10637,8 +10690,8 @@ async function _pack({
|
|
|
10637
10690
|
* @returns {Promise<PackObjectsResult>}
|
|
10638
10691
|
* @see PackObjectsResult
|
|
10639
10692
|
*/
|
|
10640
|
-
async function _packObjects({ fs, gitdir, oids, write }) {
|
|
10641
|
-
const buffers = await _pack({ fs, gitdir, oids });
|
|
10693
|
+
async function _packObjects({ fs, cache, gitdir, oids, write }) {
|
|
10694
|
+
const buffers = await _pack({ fs, cache, gitdir, oids });
|
|
10642
10695
|
const packfile = Buffer.from(await collect(buffers));
|
|
10643
10696
|
const packfileSha = packfile.slice(-20).toString('hex');
|
|
10644
10697
|
const filename = `pack-${packfileSha}.pack`;
|
|
@@ -10670,6 +10723,7 @@ async function _packObjects({ fs, gitdir, oids, write }) {
|
|
|
10670
10723
|
* @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
10671
10724
|
* @param {string[]} args.oids - An array of SHA-1 object ids to be included in the packfile
|
|
10672
10725
|
* @param {boolean} [args.write = false] - Whether to save the packfile to disk or not
|
|
10726
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
10673
10727
|
*
|
|
10674
10728
|
* @returns {Promise<PackObjectsResult>} Resolves successfully when the packfile is ready with the filename and buffer
|
|
10675
10729
|
* @see PackObjectsResult
|
|
@@ -10690,6 +10744,7 @@ async function packObjects({
|
|
|
10690
10744
|
gitdir = join(dir, '.git'),
|
|
10691
10745
|
oids,
|
|
10692
10746
|
write = false,
|
|
10747
|
+
cache = {},
|
|
10693
10748
|
}) {
|
|
10694
10749
|
try {
|
|
10695
10750
|
assertParameter('fs', fs);
|
|
@@ -10698,6 +10753,7 @@ async function packObjects({
|
|
|
10698
10753
|
|
|
10699
10754
|
return await _packObjects({
|
|
10700
10755
|
fs: new FileSystem(fs),
|
|
10756
|
+
cache,
|
|
10701
10757
|
gitdir,
|
|
10702
10758
|
oids,
|
|
10703
10759
|
write,
|
|
@@ -10742,6 +10798,7 @@ async function packObjects({
|
|
|
10742
10798
|
* @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).
|
|
10743
10799
|
* @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.
|
|
10744
10800
|
* @param {string} [args.signingKey] - passed to [commit](commit.md) when creating a merge commit
|
|
10801
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
10745
10802
|
*
|
|
10746
10803
|
* @returns {Promise<void>} Resolves successfully when pull operation completes
|
|
10747
10804
|
*
|
|
@@ -10777,6 +10834,7 @@ async function pull({
|
|
|
10777
10834
|
author: _author,
|
|
10778
10835
|
committer: _committer,
|
|
10779
10836
|
signingKey,
|
|
10837
|
+
cache = {},
|
|
10780
10838
|
}) {
|
|
10781
10839
|
try {
|
|
10782
10840
|
assertParameter('fs', _fs);
|
|
@@ -10797,7 +10855,7 @@ async function pull({
|
|
|
10797
10855
|
|
|
10798
10856
|
return await _pull({
|
|
10799
10857
|
fs,
|
|
10800
|
-
cache
|
|
10858
|
+
cache,
|
|
10801
10859
|
http,
|
|
10802
10860
|
onProgress,
|
|
10803
10861
|
onMessage,
|
|
@@ -11087,6 +11145,7 @@ async function _push({
|
|
|
11087
11145
|
service: 'git-receive-pack',
|
|
11088
11146
|
url,
|
|
11089
11147
|
headers,
|
|
11148
|
+
protocolVersion: 1,
|
|
11090
11149
|
});
|
|
11091
11150
|
const auth = httpRemote.auth; // hack to get new credentials from CredentialManager API
|
|
11092
11151
|
let fullRemoteRef;
|
|
@@ -11218,6 +11277,7 @@ async function _push({
|
|
|
11218
11277
|
? []
|
|
11219
11278
|
: await _pack({
|
|
11220
11279
|
fs,
|
|
11280
|
+
cache,
|
|
11221
11281
|
gitdir,
|
|
11222
11282
|
oids: [...objects],
|
|
11223
11283
|
});
|
|
@@ -11299,6 +11359,7 @@ async function _push({
|
|
|
11299
11359
|
* @param {boolean} [args.delete = false] - If true, delete the remote ref
|
|
11300
11360
|
* @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.
|
|
11301
11361
|
* @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config
|
|
11362
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
11302
11363
|
*
|
|
11303
11364
|
* @returns {Promise<PushResult>} Resolves successfully when push completes with a detailed description of the operation from the server.
|
|
11304
11365
|
* @see PushResult
|
|
@@ -11334,6 +11395,7 @@ async function push({
|
|
|
11334
11395
|
delete: _delete = false,
|
|
11335
11396
|
corsProxy,
|
|
11336
11397
|
headers = {},
|
|
11398
|
+
cache = {},
|
|
11337
11399
|
}) {
|
|
11338
11400
|
try {
|
|
11339
11401
|
assertParameter('fs', fs);
|
|
@@ -11342,7 +11404,7 @@ async function push({
|
|
|
11342
11404
|
|
|
11343
11405
|
return await _push({
|
|
11344
11406
|
fs: new FileSystem(fs),
|
|
11345
|
-
cache
|
|
11407
|
+
cache,
|
|
11346
11408
|
http,
|
|
11347
11409
|
onProgress,
|
|
11348
11410
|
onMessage,
|
|
@@ -11437,6 +11499,7 @@ async function _readBlob({
|
|
|
11437
11499
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
11438
11500
|
* @param {string} args.oid - The SHA-1 object id to get. Annotated tags, commits, and trees are peeled.
|
|
11439
11501
|
* @param {string} [args.filepath] - Don't return the object with `oid` itself, but resolve `oid` to a tree and then return the blob object at that filepath.
|
|
11502
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
11440
11503
|
*
|
|
11441
11504
|
* @returns {Promise<ReadBlobResult>} Resolves successfully with a blob object description
|
|
11442
11505
|
* @see ReadBlobResult
|
|
@@ -11460,6 +11523,7 @@ async function readBlob({
|
|
|
11460
11523
|
gitdir = join(dir, '.git'),
|
|
11461
11524
|
oid,
|
|
11462
11525
|
filepath,
|
|
11526
|
+
cache = {},
|
|
11463
11527
|
}) {
|
|
11464
11528
|
try {
|
|
11465
11529
|
assertParameter('fs', fs);
|
|
@@ -11468,7 +11532,7 @@ async function readBlob({
|
|
|
11468
11532
|
|
|
11469
11533
|
return await _readBlob({
|
|
11470
11534
|
fs: new FileSystem(fs),
|
|
11471
|
-
cache
|
|
11535
|
+
cache,
|
|
11472
11536
|
gitdir,
|
|
11473
11537
|
oid,
|
|
11474
11538
|
filepath,
|
|
@@ -11489,6 +11553,7 @@ async function readBlob({
|
|
|
11489
11553
|
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
|
|
11490
11554
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
11491
11555
|
* @param {string} args.oid - The SHA-1 object id to get. Annotated tags are peeled.
|
|
11556
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
11492
11557
|
*
|
|
11493
11558
|
* @returns {Promise<ReadCommitResult>} Resolves successfully with a git commit object
|
|
11494
11559
|
* @see ReadCommitResult
|
|
@@ -11502,7 +11567,13 @@ async function readBlob({
|
|
|
11502
11567
|
* console.log(commit)
|
|
11503
11568
|
*
|
|
11504
11569
|
*/
|
|
11505
|
-
async function readCommit({
|
|
11570
|
+
async function readCommit({
|
|
11571
|
+
fs,
|
|
11572
|
+
dir,
|
|
11573
|
+
gitdir = join(dir, '.git'),
|
|
11574
|
+
oid,
|
|
11575
|
+
cache = {},
|
|
11576
|
+
}) {
|
|
11506
11577
|
try {
|
|
11507
11578
|
assertParameter('fs', fs);
|
|
11508
11579
|
assertParameter('gitdir', gitdir);
|
|
@@ -11510,7 +11581,7 @@ async function readCommit({ fs, dir, gitdir = join(dir, '.git'), oid }) {
|
|
|
11510
11581
|
|
|
11511
11582
|
return await _readCommit({
|
|
11512
11583
|
fs: new FileSystem(fs),
|
|
11513
|
-
cache
|
|
11584
|
+
cache,
|
|
11514
11585
|
gitdir,
|
|
11515
11586
|
oid,
|
|
11516
11587
|
})
|
|
@@ -11565,6 +11636,7 @@ async function _readNote({
|
|
|
11565
11636
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
11566
11637
|
* @param {string} [args.ref] - The notes ref to look under
|
|
11567
11638
|
* @param {string} args.oid - The SHA-1 object id of the object to get the note for.
|
|
11639
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
11568
11640
|
*
|
|
11569
11641
|
* @returns {Promise<Uint8Array>} Resolves successfully with note contents as a Buffer.
|
|
11570
11642
|
*/
|
|
@@ -11575,6 +11647,7 @@ async function readNote({
|
|
|
11575
11647
|
gitdir = join(dir, '.git'),
|
|
11576
11648
|
ref = 'refs/notes/commits',
|
|
11577
11649
|
oid,
|
|
11650
|
+
cache = {},
|
|
11578
11651
|
}) {
|
|
11579
11652
|
try {
|
|
11580
11653
|
assertParameter('fs', fs);
|
|
@@ -11584,7 +11657,7 @@ async function readNote({
|
|
|
11584
11657
|
|
|
11585
11658
|
return await _readNote({
|
|
11586
11659
|
fs: new FileSystem(fs),
|
|
11587
|
-
cache
|
|
11660
|
+
cache,
|
|
11588
11661
|
gitdir,
|
|
11589
11662
|
ref,
|
|
11590
11663
|
oid,
|
|
@@ -11753,6 +11826,7 @@ async function readNote({
|
|
|
11753
11826
|
* @param {'deflated' | 'wrapped' | 'content' | 'parsed'} [args.format = 'parsed'] - What format to return the object in. The choices are described in more detail below.
|
|
11754
11827
|
* @param {string} [args.filepath] - Don't return the object with `oid` itself, but resolve `oid` to a tree and then return the object at that filepath. To return the root directory of a tree set filepath to `''`
|
|
11755
11828
|
* @param {string} [args.encoding] - A convenience argument that only affects blobs. Instead of returning `object` as a buffer, it returns a string parsed using the given encoding.
|
|
11829
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
11756
11830
|
*
|
|
11757
11831
|
* @returns {Promise<ReadObjectResult>} Resolves successfully with a git object description
|
|
11758
11832
|
* @see ReadObjectResult
|
|
@@ -11792,13 +11866,13 @@ async function readObject({
|
|
|
11792
11866
|
format = 'parsed',
|
|
11793
11867
|
filepath = undefined,
|
|
11794
11868
|
encoding = undefined,
|
|
11869
|
+
cache = {},
|
|
11795
11870
|
}) {
|
|
11796
11871
|
try {
|
|
11797
11872
|
assertParameter('fs', _fs);
|
|
11798
11873
|
assertParameter('gitdir', gitdir);
|
|
11799
11874
|
assertParameter('oid', oid);
|
|
11800
11875
|
|
|
11801
|
-
const cache = {};
|
|
11802
11876
|
const fs = new FileSystem(_fs);
|
|
11803
11877
|
if (filepath !== undefined) {
|
|
11804
11878
|
oid = await resolveFilepath({
|
|
@@ -11914,13 +11988,20 @@ async function _readTag({ fs, cache, gitdir, oid }) {
|
|
|
11914
11988
|
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
|
|
11915
11989
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
11916
11990
|
* @param {string} args.oid - The SHA-1 object id to get
|
|
11991
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
11917
11992
|
*
|
|
11918
11993
|
* @returns {Promise<ReadTagResult>} Resolves successfully with a git object description
|
|
11919
11994
|
* @see ReadTagResult
|
|
11920
11995
|
* @see TagObject
|
|
11921
11996
|
*
|
|
11922
11997
|
*/
|
|
11923
|
-
async function readTag({
|
|
11998
|
+
async function readTag({
|
|
11999
|
+
fs,
|
|
12000
|
+
dir,
|
|
12001
|
+
gitdir = join(dir, '.git'),
|
|
12002
|
+
oid,
|
|
12003
|
+
cache = {},
|
|
12004
|
+
}) {
|
|
11924
12005
|
try {
|
|
11925
12006
|
assertParameter('fs', fs);
|
|
11926
12007
|
assertParameter('gitdir', gitdir);
|
|
@@ -11928,7 +12009,7 @@ async function readTag({ fs, dir, gitdir = join(dir, '.git'), oid }) {
|
|
|
11928
12009
|
|
|
11929
12010
|
return await _readTag({
|
|
11930
12011
|
fs: new FileSystem(fs),
|
|
11931
|
-
cache
|
|
12012
|
+
cache,
|
|
11932
12013
|
gitdir,
|
|
11933
12014
|
oid,
|
|
11934
12015
|
})
|
|
@@ -11956,6 +12037,7 @@ async function readTag({ fs, dir, gitdir = join(dir, '.git'), oid }) {
|
|
|
11956
12037
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
11957
12038
|
* @param {string} args.oid - The SHA-1 object id to get. Annotated tags and commits are peeled.
|
|
11958
12039
|
* @param {string} [args.filepath] - Don't return the object with `oid` itself, but resolve `oid` to a tree and then return the tree object at that filepath.
|
|
12040
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
11959
12041
|
*
|
|
11960
12042
|
* @returns {Promise<ReadTreeResult>} Resolves successfully with a git tree object
|
|
11961
12043
|
* @see ReadTreeResult
|
|
@@ -11969,6 +12051,7 @@ async function readTree({
|
|
|
11969
12051
|
gitdir = join(dir, '.git'),
|
|
11970
12052
|
oid,
|
|
11971
12053
|
filepath = undefined,
|
|
12054
|
+
cache = {},
|
|
11972
12055
|
}) {
|
|
11973
12056
|
try {
|
|
11974
12057
|
assertParameter('fs', fs);
|
|
@@ -11977,7 +12060,7 @@ async function readTree({
|
|
|
11977
12060
|
|
|
11978
12061
|
return await _readTree({
|
|
11979
12062
|
fs: new FileSystem(fs),
|
|
11980
|
-
cache
|
|
12063
|
+
cache,
|
|
11981
12064
|
gitdir,
|
|
11982
12065
|
oid,
|
|
11983
12066
|
filepath,
|
|
@@ -12000,6 +12083,7 @@ async function readTree({
|
|
|
12000
12083
|
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
|
|
12001
12084
|
* @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
12002
12085
|
* @param {string} args.filepath - The path to the file to remove from the index
|
|
12086
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
12003
12087
|
*
|
|
12004
12088
|
* @returns {Promise<void>} Resolves successfully once the git index has been updated
|
|
12005
12089
|
*
|
|
@@ -12013,13 +12097,13 @@ async function remove({
|
|
|
12013
12097
|
dir,
|
|
12014
12098
|
gitdir = join(dir, '.git'),
|
|
12015
12099
|
filepath,
|
|
12100
|
+
cache = {},
|
|
12016
12101
|
}) {
|
|
12017
12102
|
try {
|
|
12018
12103
|
assertParameter('fs', _fs);
|
|
12019
12104
|
assertParameter('gitdir', gitdir);
|
|
12020
12105
|
assertParameter('filepath', filepath);
|
|
12021
12106
|
|
|
12022
|
-
const cache = {};
|
|
12023
12107
|
await GitIndexManager.acquire(
|
|
12024
12108
|
{ fs: new FileSystem(_fs), gitdir, cache },
|
|
12025
12109
|
async function(index) {
|
|
@@ -12138,6 +12222,7 @@ async function _removeNote({
|
|
|
12138
12222
|
* @param {number} [args.committer.timestamp=Math.floor(Date.now()/1000)] - Set the committer timestamp field. This is the integer number of seconds since the Unix epoch (1970-01-01 00:00:00).
|
|
12139
12223
|
* @param {number} [args.committer.timezoneOffset] - Set the committer timezone offset field. This is the difference, in minutes, from the current timezone to UTC. Default is `(new Date()).getTimezoneOffset()`.
|
|
12140
12224
|
* @param {string} [args.signingKey] - Sign the tag object using this private PGP key.
|
|
12225
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
12141
12226
|
*
|
|
12142
12227
|
* @returns {Promise<string>} Resolves successfully with the SHA-1 object id of the commit object for the note removal.
|
|
12143
12228
|
*/
|
|
@@ -12152,6 +12237,7 @@ async function removeNote({
|
|
|
12152
12237
|
author: _author,
|
|
12153
12238
|
committer: _committer,
|
|
12154
12239
|
signingKey,
|
|
12240
|
+
cache = {},
|
|
12155
12241
|
}) {
|
|
12156
12242
|
try {
|
|
12157
12243
|
assertParameter('fs', _fs);
|
|
@@ -12159,7 +12245,6 @@ async function removeNote({
|
|
|
12159
12245
|
assertParameter('oid', oid);
|
|
12160
12246
|
|
|
12161
12247
|
const fs = new FileSystem(_fs);
|
|
12162
|
-
const cache = {};
|
|
12163
12248
|
|
|
12164
12249
|
const author = await normalizeAuthorObject({ fs, gitdir, author: _author });
|
|
12165
12250
|
if (!author) throw new MissingNameError('author')
|
|
@@ -12311,6 +12396,7 @@ async function hashObject$1({ gitdir, type, object }) {
|
|
|
12311
12396
|
* @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
12312
12397
|
* @param {string} args.filepath - The path to the file to reset in the index
|
|
12313
12398
|
* @param {string} [args.ref = 'HEAD'] - A ref to the commit to use
|
|
12399
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
12314
12400
|
*
|
|
12315
12401
|
* @returns {Promise<void>} Resolves successfully once the git index has been updated
|
|
12316
12402
|
*
|
|
@@ -12325,6 +12411,7 @@ async function resetIndex({
|
|
|
12325
12411
|
gitdir = join(dir, '.git'),
|
|
12326
12412
|
filepath,
|
|
12327
12413
|
ref = 'HEAD',
|
|
12414
|
+
cache = {},
|
|
12328
12415
|
}) {
|
|
12329
12416
|
try {
|
|
12330
12417
|
assertParameter('fs', _fs);
|
|
@@ -12333,7 +12420,6 @@ async function resetIndex({
|
|
|
12333
12420
|
assertParameter('ref', ref);
|
|
12334
12421
|
|
|
12335
12422
|
const fs = new FileSystem(_fs);
|
|
12336
|
-
const cache = {};
|
|
12337
12423
|
// Resolve commit
|
|
12338
12424
|
let oid = await GitRefManager.resolve({ fs, gitdir, ref });
|
|
12339
12425
|
let workdirOid;
|
|
@@ -12533,6 +12619,7 @@ async function setConfig({
|
|
|
12533
12619
|
* @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path
|
|
12534
12620
|
* @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
12535
12621
|
* @param {string} args.filepath - The path to the file to query
|
|
12622
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
12536
12623
|
*
|
|
12537
12624
|
* @returns {Promise<'ignored'|'unmodified'|'*modified'|'*deleted'|'*added'|'absent'|'modified'|'deleted'|'added'|'*unmodified'|'*absent'|'*undeleted'|'*undeletemodified'>} Resolves successfully with the file's git status
|
|
12538
12625
|
*
|
|
@@ -12546,6 +12633,7 @@ async function status({
|
|
|
12546
12633
|
dir,
|
|
12547
12634
|
gitdir = join(dir, '.git'),
|
|
12548
12635
|
filepath,
|
|
12636
|
+
cache = {},
|
|
12549
12637
|
}) {
|
|
12550
12638
|
try {
|
|
12551
12639
|
assertParameter('fs', _fs);
|
|
@@ -12553,7 +12641,6 @@ async function status({
|
|
|
12553
12641
|
assertParameter('filepath', filepath);
|
|
12554
12642
|
|
|
12555
12643
|
const fs = new FileSystem(_fs);
|
|
12556
|
-
const cache = {};
|
|
12557
12644
|
const ignored = await GitIgnoreManager.isIgnored({
|
|
12558
12645
|
fs,
|
|
12559
12646
|
gitdir,
|
|
@@ -12841,6 +12928,7 @@ async function getHeadTree({ fs, cache, gitdir }) {
|
|
|
12841
12928
|
* @param {string} [args.ref = 'HEAD'] - Optionally specify a different commit to compare against the workdir and stage instead of the HEAD
|
|
12842
12929
|
* @param {string[]} [args.filepaths = ['.']] - Limit the query to the given files and directories
|
|
12843
12930
|
* @param {function(string): boolean} [args.filter] - Filter the results to only those whose filepath matches a function.
|
|
12931
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
12844
12932
|
*
|
|
12845
12933
|
* @returns {Promise<Array<StatusRow>>} Resolves with a status matrix, described below.
|
|
12846
12934
|
* @see StatusRow
|
|
@@ -12852,6 +12940,7 @@ async function statusMatrix({
|
|
|
12852
12940
|
ref = 'HEAD',
|
|
12853
12941
|
filepaths = ['.'],
|
|
12854
12942
|
filter,
|
|
12943
|
+
cache = {},
|
|
12855
12944
|
}) {
|
|
12856
12945
|
try {
|
|
12857
12946
|
assertParameter('fs', _fs);
|
|
@@ -12859,7 +12948,6 @@ async function statusMatrix({
|
|
|
12859
12948
|
assertParameter('ref', ref);
|
|
12860
12949
|
|
|
12861
12950
|
const fs = new FileSystem(_fs);
|
|
12862
|
-
const cache = {};
|
|
12863
12951
|
return await _walk({
|
|
12864
12952
|
fs,
|
|
12865
12953
|
cache,
|
|
@@ -13246,6 +13334,7 @@ function version() {
|
|
|
13246
13334
|
* @param {WalkerMap} [args.map] - Transform `WalkerEntry`s into a result form
|
|
13247
13335
|
* @param {WalkerReduce} [args.reduce] - Control how mapped entries are combined with their parent result
|
|
13248
13336
|
* @param {WalkerIterate} [args.iterate] - Fine-tune how entries within a tree are iterated over
|
|
13337
|
+
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
13249
13338
|
*
|
|
13250
13339
|
* @returns {Promise<any>} The finished tree-walking result
|
|
13251
13340
|
*/
|
|
@@ -13257,6 +13346,7 @@ async function walk({
|
|
|
13257
13346
|
map,
|
|
13258
13347
|
reduce,
|
|
13259
13348
|
iterate,
|
|
13349
|
+
cache = {},
|
|
13260
13350
|
}) {
|
|
13261
13351
|
try {
|
|
13262
13352
|
assertParameter('fs', fs);
|
|
@@ -13265,7 +13355,7 @@ async function walk({
|
|
|
13265
13355
|
|
|
13266
13356
|
return await _walk({
|
|
13267
13357
|
fs: new FileSystem(fs),
|
|
13268
|
-
cache
|
|
13358
|
+
cache,
|
|
13269
13359
|
dir,
|
|
13270
13360
|
gitdir,
|
|
13271
13361
|
trees,
|