isomorphic-git 1.15.2 → 1.17.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 +3 -0
- package/browser-tests.json +4 -3
- package/index.cjs +43 -34
- package/index.d.ts +46 -24
- package/index.js +43 -34
- package/index.umd.min.d.ts +46 -24
- package/index.umd.min.js +2 -2
- package/index.umd.min.js.map +1 -1
- package/package.json +3 -3
- package/size_report.html +1 -1
package/README.md
CHANGED
|
@@ -343,6 +343,9 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
|
|
|
343
343
|
<td align="center"><a href="http://vitorluizc.github.io/"><img src="https://avatars.githubusercontent.com/u/9027363?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Vitor Luiz Cavalcanti</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=VitorLuizC" title="Documentation">📖</a></td>
|
|
344
344
|
<td align="center"><a href="https://www.platformdemos.com/"><img src="https://avatars.githubusercontent.com/u/4261788?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Shane McLaughlin</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=mshanemc" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=mshanemc" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=mshanemc" title="Tests">⚠️</a></td>
|
|
345
345
|
</tr>
|
|
346
|
+
<tr>
|
|
347
|
+
<td align="center"><a href="https://github.com/seanpoulter"><img src="https://avatars.githubusercontent.com/u/2585460?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Sean Poulter</b></sub></a><br /><a href="#maintenance-seanpoulter" title="Maintenance">🚧</a></td>
|
|
348
|
+
</tr>
|
|
346
349
|
</table>
|
|
347
350
|
|
|
348
351
|
<!-- markdownlint-restore -->
|
package/browser-tests.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
[
|
|
2
|
+
"X Chrome Mobile 99.0.4844 (Android 0.0.0)",
|
|
2
3
|
"HeadlessChrome 0.0.0 (Linux 0.0.0)",
|
|
3
|
-
"Firefox
|
|
4
|
-
"Chrome Mobile 96.0.4664 (Android 0.0.0)",
|
|
4
|
+
"Firefox 99.0.0 (Ubuntu 0.0.0)",
|
|
5
5
|
"Chrome 79.0.3945 (Windows 10 0.0.0)",
|
|
6
|
+
"Safari 13.1.0 (Mac OS X 10.15.4)",
|
|
6
7
|
"Mobile Safari 13.0.0 (iOS 13.0.0)",
|
|
7
|
-
"
|
|
8
|
+
"Chrome Mobile 99.0.4844 (Android 0.0.0)"
|
|
8
9
|
]
|
package/index.cjs
CHANGED
|
@@ -3210,6 +3210,23 @@ class MissingParameterError extends BaseError {
|
|
|
3210
3210
|
/** @type {'MissingParameterError'} */
|
|
3211
3211
|
MissingParameterError.code = 'MissingParameterError';
|
|
3212
3212
|
|
|
3213
|
+
class MultipleGitError extends BaseError {
|
|
3214
|
+
/**
|
|
3215
|
+
* @param {Error[]} errors
|
|
3216
|
+
* @param {string} message
|
|
3217
|
+
*/
|
|
3218
|
+
constructor(errors) {
|
|
3219
|
+
super(
|
|
3220
|
+
`There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more`
|
|
3221
|
+
);
|
|
3222
|
+
this.code = this.name = MultipleGitError.code;
|
|
3223
|
+
this.data = { errors };
|
|
3224
|
+
this.errors = errors;
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
/** @type {'MultipleGitError'} */
|
|
3228
|
+
MultipleGitError.code = 'MultipleGitError';
|
|
3229
|
+
|
|
3213
3230
|
class ParseError extends BaseError {
|
|
3214
3231
|
/**
|
|
3215
3232
|
* @param {string} expected
|
|
@@ -3335,6 +3352,7 @@ var Errors = /*#__PURE__*/Object.freeze({
|
|
|
3335
3352
|
MergeNotSupportedError: MergeNotSupportedError,
|
|
3336
3353
|
MissingNameError: MissingNameError,
|
|
3337
3354
|
MissingParameterError: MissingParameterError,
|
|
3355
|
+
MultipleGitError: MultipleGitError,
|
|
3338
3356
|
NoRefspecError: NoRefspecError,
|
|
3339
3357
|
NotFoundError: NotFoundError,
|
|
3340
3358
|
ObjectTypeError: ObjectTypeError,
|
|
@@ -4029,23 +4047,6 @@ function WORKDIR() {
|
|
|
4029
4047
|
|
|
4030
4048
|
// @ts-check
|
|
4031
4049
|
|
|
4032
|
-
class MultipleGitError extends BaseError {
|
|
4033
|
-
/**
|
|
4034
|
-
* @param {Error[]} errors
|
|
4035
|
-
* @param {string} message
|
|
4036
|
-
*/
|
|
4037
|
-
constructor(errors) {
|
|
4038
|
-
super(
|
|
4039
|
-
`There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more`
|
|
4040
|
-
);
|
|
4041
|
-
this.code = this.name = MultipleGitError.code;
|
|
4042
|
-
this.data = { errors };
|
|
4043
|
-
this.errors = errors;
|
|
4044
|
-
}
|
|
4045
|
-
}
|
|
4046
|
-
/** @type {'MultipleGitError'} */
|
|
4047
|
-
MultipleGitError.code = 'MultipleGitError';
|
|
4048
|
-
|
|
4049
4050
|
// I'm putting this in a Manager because I reckon it could benefit
|
|
4050
4051
|
// from a LOT of cacheing.
|
|
4051
4052
|
class GitIgnoreManager {
|
|
@@ -4447,6 +4448,7 @@ function assertParameter(name, value) {
|
|
|
4447
4448
|
* @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
4448
4449
|
* @param {string|string[]} args.filepath - The path to the file to add to the index
|
|
4449
4450
|
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
4451
|
+
* @param {boolean} [args.force=false] - add to index even if matches gitignore. Think `git add --force`
|
|
4450
4452
|
*
|
|
4451
4453
|
* @returns {Promise<void>} Resolves successfully once the git index has been updated
|
|
4452
4454
|
*
|
|
@@ -4462,16 +4464,17 @@ async function add({
|
|
|
4462
4464
|
gitdir = join(dir, '.git'),
|
|
4463
4465
|
filepath,
|
|
4464
4466
|
cache = {},
|
|
4467
|
+
force = false,
|
|
4465
4468
|
}) {
|
|
4466
4469
|
try {
|
|
4467
4470
|
assertParameter('fs', _fs);
|
|
4468
4471
|
assertParameter('dir', dir);
|
|
4469
4472
|
assertParameter('gitdir', gitdir);
|
|
4470
|
-
assertParameter('
|
|
4473
|
+
assertParameter('filepath', filepath);
|
|
4471
4474
|
|
|
4472
4475
|
const fs = new FileSystem(_fs);
|
|
4473
4476
|
await GitIndexManager.acquire({ fs, gitdir, cache }, async index => {
|
|
4474
|
-
return addToIndex({ dir, gitdir, fs, filepath, index })
|
|
4477
|
+
return addToIndex({ dir, gitdir, fs, filepath, index, force })
|
|
4475
4478
|
});
|
|
4476
4479
|
} catch (err) {
|
|
4477
4480
|
err.caller = 'git.add';
|
|
@@ -4479,17 +4482,19 @@ async function add({
|
|
|
4479
4482
|
}
|
|
4480
4483
|
}
|
|
4481
4484
|
|
|
4482
|
-
async function addToIndex({ dir, gitdir, fs, filepath, index }) {
|
|
4485
|
+
async function addToIndex({ dir, gitdir, fs, filepath, index, force }) {
|
|
4483
4486
|
// TODO: Should ignore UNLESS it's already in the index.
|
|
4484
4487
|
filepath = Array.isArray(filepath) ? filepath : [filepath];
|
|
4485
4488
|
const promises = filepath.map(async currentFilepath => {
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4489
|
+
if (!force) {
|
|
4490
|
+
const ignored = await GitIgnoreManager.isIgnored({
|
|
4491
|
+
fs,
|
|
4492
|
+
dir,
|
|
4493
|
+
gitdir,
|
|
4494
|
+
filepath: currentFilepath,
|
|
4495
|
+
});
|
|
4496
|
+
if (ignored) return
|
|
4497
|
+
}
|
|
4493
4498
|
const stats = await fs.lstat(join(dir, currentFilepath));
|
|
4494
4499
|
if (!stats) throw new NotFoundError(currentFilepath)
|
|
4495
4500
|
|
|
@@ -4502,6 +4507,7 @@ async function addToIndex({ dir, gitdir, fs, filepath, index }) {
|
|
|
4502
4507
|
fs,
|
|
4503
4508
|
filepath: [join(currentFilepath, child)],
|
|
4504
4509
|
index,
|
|
4510
|
+
force,
|
|
4505
4511
|
})
|
|
4506
4512
|
);
|
|
4507
4513
|
await Promise.all(promises);
|
|
@@ -6918,8 +6924,8 @@ function filterCapabilities(server, client) {
|
|
|
6918
6924
|
|
|
6919
6925
|
const pkg = {
|
|
6920
6926
|
name: 'isomorphic-git',
|
|
6921
|
-
version: '1.
|
|
6922
|
-
agent: 'git/isomorphic-git@1.
|
|
6927
|
+
version: '1.17.1',
|
|
6928
|
+
agent: 'git/isomorphic-git@1.17.1',
|
|
6923
6929
|
};
|
|
6924
6930
|
|
|
6925
6931
|
class FIFO {
|
|
@@ -13342,6 +13348,7 @@ async function getHeadTree({ fs, cache, gitdir }) {
|
|
|
13342
13348
|
* @param {string[]} [args.filepaths = ['.']] - Limit the query to the given files and directories
|
|
13343
13349
|
* @param {function(string): boolean} [args.filter] - Filter the results to only those whose filepath matches a function.
|
|
13344
13350
|
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
13351
|
+
* @param {boolean} [args.ignored = false] - include ignored files in the result
|
|
13345
13352
|
*
|
|
13346
13353
|
* @returns {Promise<Array<StatusRow>>} Resolves with a status matrix, described below.
|
|
13347
13354
|
* @see StatusRow
|
|
@@ -13354,6 +13361,7 @@ async function statusMatrix({
|
|
|
13354
13361
|
filepaths = ['.'],
|
|
13355
13362
|
filter,
|
|
13356
13363
|
cache = {},
|
|
13364
|
+
ignored: shouldIgnore = false,
|
|
13357
13365
|
}) {
|
|
13358
13366
|
try {
|
|
13359
13367
|
assertParameter('fs', _fs);
|
|
@@ -13370,14 +13378,15 @@ async function statusMatrix({
|
|
|
13370
13378
|
map: async function(filepath, [head, workdir, stage]) {
|
|
13371
13379
|
// Ignore ignored files, but only if they are not already tracked.
|
|
13372
13380
|
if (!head && !stage && workdir) {
|
|
13373
|
-
if (
|
|
13374
|
-
await GitIgnoreManager.isIgnored({
|
|
13381
|
+
if (!shouldIgnore) {
|
|
13382
|
+
const isIgnored = await GitIgnoreManager.isIgnored({
|
|
13375
13383
|
fs,
|
|
13376
13384
|
dir,
|
|
13377
13385
|
filepath,
|
|
13378
|
-
})
|
|
13379
|
-
|
|
13380
|
-
|
|
13386
|
+
});
|
|
13387
|
+
if (isIgnored) {
|
|
13388
|
+
return null
|
|
13389
|
+
}
|
|
13381
13390
|
}
|
|
13382
13391
|
}
|
|
13383
13392
|
// match against base paths
|
package/index.d.ts
CHANGED
|
@@ -717,6 +717,7 @@ export var Errors: Readonly<{
|
|
|
717
717
|
MergeNotSupportedError: typeof MergeNotSupportedError;
|
|
718
718
|
MissingNameError: typeof MissingNameError;
|
|
719
719
|
MissingParameterError: typeof MissingParameterError;
|
|
720
|
+
MultipleGitError: typeof MultipleGitError;
|
|
720
721
|
NoRefspecError: typeof NoRefspecError;
|
|
721
722
|
NotFoundError: typeof NotFoundError;
|
|
722
723
|
ObjectTypeError: typeof ObjectTypeError;
|
|
@@ -754,6 +755,7 @@ export function WORKDIR(): Walker;
|
|
|
754
755
|
* @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
755
756
|
* @param {string|string[]} args.filepath - The path to the file to add to the index
|
|
756
757
|
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
758
|
+
* @param {boolean} [args.force=false] - add to index even if matches gitignore. Think `git add --force`
|
|
757
759
|
*
|
|
758
760
|
* @returns {Promise<void>} Resolves successfully once the git index has been updated
|
|
759
761
|
*
|
|
@@ -763,12 +765,13 @@ export function WORKDIR(): Walker;
|
|
|
763
765
|
* console.log('done')
|
|
764
766
|
*
|
|
765
767
|
*/
|
|
766
|
-
export function add({ fs: _fs, dir, gitdir, filepath, cache, }: {
|
|
768
|
+
export function add({ fs: _fs, dir, gitdir, filepath, cache, force, }: {
|
|
767
769
|
fs: CallbackFsClient | PromiseFsClient;
|
|
768
770
|
dir: string;
|
|
769
771
|
gitdir?: string;
|
|
770
772
|
filepath: string | string[];
|
|
771
773
|
cache?: any;
|
|
774
|
+
force?: boolean;
|
|
772
775
|
}): Promise<void>;
|
|
773
776
|
/**
|
|
774
777
|
* Add or update an object note
|
|
@@ -3069,11 +3072,12 @@ export function status({ fs: _fs, dir, gitdir, filepath, cache, }: {
|
|
|
3069
3072
|
* @param {string[]} [args.filepaths = ['.']] - Limit the query to the given files and directories
|
|
3070
3073
|
* @param {function(string): boolean} [args.filter] - Filter the results to only those whose filepath matches a function.
|
|
3071
3074
|
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
3075
|
+
* @param {boolean} [args.ignored = false] - include ignored files in the result
|
|
3072
3076
|
*
|
|
3073
3077
|
* @returns {Promise<Array<StatusRow>>} Resolves with a status matrix, described below.
|
|
3074
3078
|
* @see StatusRow
|
|
3075
3079
|
*/
|
|
3076
|
-
export function statusMatrix({ fs: _fs, dir, gitdir, ref, filepaths, filter, cache, }: {
|
|
3080
|
+
export function statusMatrix({ fs: _fs, dir, gitdir, ref, filepaths, filter, cache, ignored: shouldIgnore, }: {
|
|
3077
3081
|
fs: CallbackFsClient | PromiseFsClient;
|
|
3078
3082
|
dir: string;
|
|
3079
3083
|
gitdir?: string;
|
|
@@ -3081,6 +3085,7 @@ export function statusMatrix({ fs: _fs, dir, gitdir, ref, filepaths, filter, cac
|
|
|
3081
3085
|
filepaths?: string[];
|
|
3082
3086
|
filter?: (arg0: string) => boolean;
|
|
3083
3087
|
cache?: any;
|
|
3088
|
+
ignored?: boolean;
|
|
3084
3089
|
}): Promise<[string, 0 | 1, 0 | 1 | 2, 0 | 1 | 2 | 3][]>;
|
|
3085
3090
|
/**
|
|
3086
3091
|
* Create a lightweight tag
|
|
@@ -3889,6 +3894,23 @@ declare namespace MissingParameterError {
|
|
|
3889
3894
|
const code_15: 'MissingParameterError';
|
|
3890
3895
|
export { code_15 as code };
|
|
3891
3896
|
}
|
|
3897
|
+
declare class MultipleGitError extends BaseError {
|
|
3898
|
+
/**
|
|
3899
|
+
* @param {Error[]} errors
|
|
3900
|
+
* @param {string} message
|
|
3901
|
+
*/
|
|
3902
|
+
constructor(errors: Error[]);
|
|
3903
|
+
code: "MultipleGitError";
|
|
3904
|
+
name: "MultipleGitError";
|
|
3905
|
+
data: {
|
|
3906
|
+
errors: Error[];
|
|
3907
|
+
};
|
|
3908
|
+
errors: Error[];
|
|
3909
|
+
}
|
|
3910
|
+
declare namespace MultipleGitError {
|
|
3911
|
+
const code_16: 'MultipleGitError';
|
|
3912
|
+
export { code_16 as code };
|
|
3913
|
+
}
|
|
3892
3914
|
declare class NoRefspecError extends BaseError {
|
|
3893
3915
|
/**
|
|
3894
3916
|
* @param {string} remote
|
|
@@ -3901,8 +3923,8 @@ declare class NoRefspecError extends BaseError {
|
|
|
3901
3923
|
};
|
|
3902
3924
|
}
|
|
3903
3925
|
declare namespace NoRefspecError {
|
|
3904
|
-
const
|
|
3905
|
-
export {
|
|
3926
|
+
const code_17: 'NoRefspecError';
|
|
3927
|
+
export { code_17 as code };
|
|
3906
3928
|
}
|
|
3907
3929
|
declare class NotFoundError extends BaseError {
|
|
3908
3930
|
/**
|
|
@@ -3916,8 +3938,8 @@ declare class NotFoundError extends BaseError {
|
|
|
3916
3938
|
};
|
|
3917
3939
|
}
|
|
3918
3940
|
declare namespace NotFoundError {
|
|
3919
|
-
const
|
|
3920
|
-
export {
|
|
3941
|
+
const code_18: 'NotFoundError';
|
|
3942
|
+
export { code_18 as code };
|
|
3921
3943
|
}
|
|
3922
3944
|
declare class ObjectTypeError extends BaseError {
|
|
3923
3945
|
/**
|
|
@@ -3937,8 +3959,8 @@ declare class ObjectTypeError extends BaseError {
|
|
|
3937
3959
|
};
|
|
3938
3960
|
}
|
|
3939
3961
|
declare namespace ObjectTypeError {
|
|
3940
|
-
const
|
|
3941
|
-
export {
|
|
3962
|
+
const code_19: 'ObjectTypeError';
|
|
3963
|
+
export { code_19 as code };
|
|
3942
3964
|
}
|
|
3943
3965
|
declare class ParseError extends BaseError {
|
|
3944
3966
|
/**
|
|
@@ -3954,8 +3976,8 @@ declare class ParseError extends BaseError {
|
|
|
3954
3976
|
};
|
|
3955
3977
|
}
|
|
3956
3978
|
declare namespace ParseError {
|
|
3957
|
-
const
|
|
3958
|
-
export {
|
|
3979
|
+
const code_20: 'ParseError';
|
|
3980
|
+
export { code_20 as code };
|
|
3959
3981
|
}
|
|
3960
3982
|
declare class PushRejectedError extends BaseError {
|
|
3961
3983
|
/**
|
|
@@ -3969,8 +3991,8 @@ declare class PushRejectedError extends BaseError {
|
|
|
3969
3991
|
};
|
|
3970
3992
|
}
|
|
3971
3993
|
declare namespace PushRejectedError {
|
|
3972
|
-
const
|
|
3973
|
-
export {
|
|
3994
|
+
const code_21: 'PushRejectedError';
|
|
3995
|
+
export { code_21 as code };
|
|
3974
3996
|
}
|
|
3975
3997
|
declare class RemoteCapabilityError extends BaseError {
|
|
3976
3998
|
/**
|
|
@@ -3986,8 +4008,8 @@ declare class RemoteCapabilityError extends BaseError {
|
|
|
3986
4008
|
};
|
|
3987
4009
|
}
|
|
3988
4010
|
declare namespace RemoteCapabilityError {
|
|
3989
|
-
const
|
|
3990
|
-
export {
|
|
4011
|
+
const code_22: 'RemoteCapabilityError';
|
|
4012
|
+
export { code_22 as code };
|
|
3991
4013
|
}
|
|
3992
4014
|
declare class SmartHttpError extends BaseError {
|
|
3993
4015
|
/**
|
|
@@ -4003,8 +4025,8 @@ declare class SmartHttpError extends BaseError {
|
|
|
4003
4025
|
};
|
|
4004
4026
|
}
|
|
4005
4027
|
declare namespace SmartHttpError {
|
|
4006
|
-
const
|
|
4007
|
-
export {
|
|
4028
|
+
const code_23: 'SmartHttpError';
|
|
4029
|
+
export { code_23 as code };
|
|
4008
4030
|
}
|
|
4009
4031
|
declare class UnknownTransportError extends BaseError {
|
|
4010
4032
|
/**
|
|
@@ -4022,8 +4044,8 @@ declare class UnknownTransportError extends BaseError {
|
|
|
4022
4044
|
};
|
|
4023
4045
|
}
|
|
4024
4046
|
declare namespace UnknownTransportError {
|
|
4025
|
-
const
|
|
4026
|
-
export {
|
|
4047
|
+
const code_24: 'UnknownTransportError';
|
|
4048
|
+
export { code_24 as code };
|
|
4027
4049
|
}
|
|
4028
4050
|
declare class UnsafeFilepathError extends BaseError {
|
|
4029
4051
|
/**
|
|
@@ -4037,8 +4059,8 @@ declare class UnsafeFilepathError extends BaseError {
|
|
|
4037
4059
|
};
|
|
4038
4060
|
}
|
|
4039
4061
|
declare namespace UnsafeFilepathError {
|
|
4040
|
-
const
|
|
4041
|
-
export {
|
|
4062
|
+
const code_25: 'UnsafeFilepathError';
|
|
4063
|
+
export { code_25 as code };
|
|
4042
4064
|
}
|
|
4043
4065
|
declare class UrlParseError extends BaseError {
|
|
4044
4066
|
/**
|
|
@@ -4052,8 +4074,8 @@ declare class UrlParseError extends BaseError {
|
|
|
4052
4074
|
};
|
|
4053
4075
|
}
|
|
4054
4076
|
declare namespace UrlParseError {
|
|
4055
|
-
const
|
|
4056
|
-
export {
|
|
4077
|
+
const code_26: 'UrlParseError';
|
|
4078
|
+
export { code_26 as code };
|
|
4057
4079
|
}
|
|
4058
4080
|
declare class UserCanceledError extends BaseError {
|
|
4059
4081
|
code: "UserCanceledError";
|
|
@@ -4061,8 +4083,8 @@ declare class UserCanceledError extends BaseError {
|
|
|
4061
4083
|
data: {};
|
|
4062
4084
|
}
|
|
4063
4085
|
declare namespace UserCanceledError {
|
|
4064
|
-
const
|
|
4065
|
-
export {
|
|
4086
|
+
const code_27: 'UserCanceledError';
|
|
4087
|
+
export { code_27 as code };
|
|
4066
4088
|
}
|
|
4067
4089
|
/**
|
|
4068
4090
|
* @typedef {Object} GitProgressEvent
|
package/index.js
CHANGED
|
@@ -3204,6 +3204,23 @@ class MissingParameterError extends BaseError {
|
|
|
3204
3204
|
/** @type {'MissingParameterError'} */
|
|
3205
3205
|
MissingParameterError.code = 'MissingParameterError';
|
|
3206
3206
|
|
|
3207
|
+
class MultipleGitError extends BaseError {
|
|
3208
|
+
/**
|
|
3209
|
+
* @param {Error[]} errors
|
|
3210
|
+
* @param {string} message
|
|
3211
|
+
*/
|
|
3212
|
+
constructor(errors) {
|
|
3213
|
+
super(
|
|
3214
|
+
`There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more`
|
|
3215
|
+
);
|
|
3216
|
+
this.code = this.name = MultipleGitError.code;
|
|
3217
|
+
this.data = { errors };
|
|
3218
|
+
this.errors = errors;
|
|
3219
|
+
}
|
|
3220
|
+
}
|
|
3221
|
+
/** @type {'MultipleGitError'} */
|
|
3222
|
+
MultipleGitError.code = 'MultipleGitError';
|
|
3223
|
+
|
|
3207
3224
|
class ParseError extends BaseError {
|
|
3208
3225
|
/**
|
|
3209
3226
|
* @param {string} expected
|
|
@@ -3329,6 +3346,7 @@ var Errors = /*#__PURE__*/Object.freeze({
|
|
|
3329
3346
|
MergeNotSupportedError: MergeNotSupportedError,
|
|
3330
3347
|
MissingNameError: MissingNameError,
|
|
3331
3348
|
MissingParameterError: MissingParameterError,
|
|
3349
|
+
MultipleGitError: MultipleGitError,
|
|
3332
3350
|
NoRefspecError: NoRefspecError,
|
|
3333
3351
|
NotFoundError: NotFoundError,
|
|
3334
3352
|
ObjectTypeError: ObjectTypeError,
|
|
@@ -4023,23 +4041,6 @@ function WORKDIR() {
|
|
|
4023
4041
|
|
|
4024
4042
|
// @ts-check
|
|
4025
4043
|
|
|
4026
|
-
class MultipleGitError extends BaseError {
|
|
4027
|
-
/**
|
|
4028
|
-
* @param {Error[]} errors
|
|
4029
|
-
* @param {string} message
|
|
4030
|
-
*/
|
|
4031
|
-
constructor(errors) {
|
|
4032
|
-
super(
|
|
4033
|
-
`There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more`
|
|
4034
|
-
);
|
|
4035
|
-
this.code = this.name = MultipleGitError.code;
|
|
4036
|
-
this.data = { errors };
|
|
4037
|
-
this.errors = errors;
|
|
4038
|
-
}
|
|
4039
|
-
}
|
|
4040
|
-
/** @type {'MultipleGitError'} */
|
|
4041
|
-
MultipleGitError.code = 'MultipleGitError';
|
|
4042
|
-
|
|
4043
4044
|
// I'm putting this in a Manager because I reckon it could benefit
|
|
4044
4045
|
// from a LOT of cacheing.
|
|
4045
4046
|
class GitIgnoreManager {
|
|
@@ -4441,6 +4442,7 @@ function assertParameter(name, value) {
|
|
|
4441
4442
|
* @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
4442
4443
|
* @param {string|string[]} args.filepath - The path to the file to add to the index
|
|
4443
4444
|
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
4445
|
+
* @param {boolean} [args.force=false] - add to index even if matches gitignore. Think `git add --force`
|
|
4444
4446
|
*
|
|
4445
4447
|
* @returns {Promise<void>} Resolves successfully once the git index has been updated
|
|
4446
4448
|
*
|
|
@@ -4456,16 +4458,17 @@ async function add({
|
|
|
4456
4458
|
gitdir = join(dir, '.git'),
|
|
4457
4459
|
filepath,
|
|
4458
4460
|
cache = {},
|
|
4461
|
+
force = false,
|
|
4459
4462
|
}) {
|
|
4460
4463
|
try {
|
|
4461
4464
|
assertParameter('fs', _fs);
|
|
4462
4465
|
assertParameter('dir', dir);
|
|
4463
4466
|
assertParameter('gitdir', gitdir);
|
|
4464
|
-
assertParameter('
|
|
4467
|
+
assertParameter('filepath', filepath);
|
|
4465
4468
|
|
|
4466
4469
|
const fs = new FileSystem(_fs);
|
|
4467
4470
|
await GitIndexManager.acquire({ fs, gitdir, cache }, async index => {
|
|
4468
|
-
return addToIndex({ dir, gitdir, fs, filepath, index })
|
|
4471
|
+
return addToIndex({ dir, gitdir, fs, filepath, index, force })
|
|
4469
4472
|
});
|
|
4470
4473
|
} catch (err) {
|
|
4471
4474
|
err.caller = 'git.add';
|
|
@@ -4473,17 +4476,19 @@ async function add({
|
|
|
4473
4476
|
}
|
|
4474
4477
|
}
|
|
4475
4478
|
|
|
4476
|
-
async function addToIndex({ dir, gitdir, fs, filepath, index }) {
|
|
4479
|
+
async function addToIndex({ dir, gitdir, fs, filepath, index, force }) {
|
|
4477
4480
|
// TODO: Should ignore UNLESS it's already in the index.
|
|
4478
4481
|
filepath = Array.isArray(filepath) ? filepath : [filepath];
|
|
4479
4482
|
const promises = filepath.map(async currentFilepath => {
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4483
|
+
if (!force) {
|
|
4484
|
+
const ignored = await GitIgnoreManager.isIgnored({
|
|
4485
|
+
fs,
|
|
4486
|
+
dir,
|
|
4487
|
+
gitdir,
|
|
4488
|
+
filepath: currentFilepath,
|
|
4489
|
+
});
|
|
4490
|
+
if (ignored) return
|
|
4491
|
+
}
|
|
4487
4492
|
const stats = await fs.lstat(join(dir, currentFilepath));
|
|
4488
4493
|
if (!stats) throw new NotFoundError(currentFilepath)
|
|
4489
4494
|
|
|
@@ -4496,6 +4501,7 @@ async function addToIndex({ dir, gitdir, fs, filepath, index }) {
|
|
|
4496
4501
|
fs,
|
|
4497
4502
|
filepath: [join(currentFilepath, child)],
|
|
4498
4503
|
index,
|
|
4504
|
+
force,
|
|
4499
4505
|
})
|
|
4500
4506
|
);
|
|
4501
4507
|
await Promise.all(promises);
|
|
@@ -6912,8 +6918,8 @@ function filterCapabilities(server, client) {
|
|
|
6912
6918
|
|
|
6913
6919
|
const pkg = {
|
|
6914
6920
|
name: 'isomorphic-git',
|
|
6915
|
-
version: '1.
|
|
6916
|
-
agent: 'git/isomorphic-git@1.
|
|
6921
|
+
version: '1.17.1',
|
|
6922
|
+
agent: 'git/isomorphic-git@1.17.1',
|
|
6917
6923
|
};
|
|
6918
6924
|
|
|
6919
6925
|
class FIFO {
|
|
@@ -13336,6 +13342,7 @@ async function getHeadTree({ fs, cache, gitdir }) {
|
|
|
13336
13342
|
* @param {string[]} [args.filepaths = ['.']] - Limit the query to the given files and directories
|
|
13337
13343
|
* @param {function(string): boolean} [args.filter] - Filter the results to only those whose filepath matches a function.
|
|
13338
13344
|
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
13345
|
+
* @param {boolean} [args.ignored = false] - include ignored files in the result
|
|
13339
13346
|
*
|
|
13340
13347
|
* @returns {Promise<Array<StatusRow>>} Resolves with a status matrix, described below.
|
|
13341
13348
|
* @see StatusRow
|
|
@@ -13348,6 +13355,7 @@ async function statusMatrix({
|
|
|
13348
13355
|
filepaths = ['.'],
|
|
13349
13356
|
filter,
|
|
13350
13357
|
cache = {},
|
|
13358
|
+
ignored: shouldIgnore = false,
|
|
13351
13359
|
}) {
|
|
13352
13360
|
try {
|
|
13353
13361
|
assertParameter('fs', _fs);
|
|
@@ -13364,14 +13372,15 @@ async function statusMatrix({
|
|
|
13364
13372
|
map: async function(filepath, [head, workdir, stage]) {
|
|
13365
13373
|
// Ignore ignored files, but only if they are not already tracked.
|
|
13366
13374
|
if (!head && !stage && workdir) {
|
|
13367
|
-
if (
|
|
13368
|
-
await GitIgnoreManager.isIgnored({
|
|
13375
|
+
if (!shouldIgnore) {
|
|
13376
|
+
const isIgnored = await GitIgnoreManager.isIgnored({
|
|
13369
13377
|
fs,
|
|
13370
13378
|
dir,
|
|
13371
13379
|
filepath,
|
|
13372
|
-
})
|
|
13373
|
-
|
|
13374
|
-
|
|
13380
|
+
});
|
|
13381
|
+
if (isIgnored) {
|
|
13382
|
+
return null
|
|
13383
|
+
}
|
|
13375
13384
|
}
|
|
13376
13385
|
}
|
|
13377
13386
|
// match against base paths
|