isomorphic-git 1.42.5 → 1.42.7
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 +2 -0
- package/index.cjs +181 -9
- package/index.d.cts +84 -64
- package/index.d.ts +84 -64
- package/index.js +181 -9
- package/index.umd.min.d.ts +84 -64
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +72 -7
- package/managers/index.js +72 -7
- package/managers/index.umd.min.js +1 -1
- package/managers/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -710,6 +710,7 @@ export var Errors: Readonly<{
|
|
|
710
710
|
AlreadyExistsError: typeof AlreadyExistsError;
|
|
711
711
|
AmbiguousError: typeof AmbiguousError;
|
|
712
712
|
CheckoutConflictError: typeof CheckoutConflictError;
|
|
713
|
+
CherryPickLocalChangesError: typeof CherryPickLocalChangesError;
|
|
713
714
|
CherryPickMergeCommitError: typeof CherryPickMergeCommitError;
|
|
714
715
|
CherryPickRootCommitError: typeof CherryPickRootCommitError;
|
|
715
716
|
CommitNotFetchedError: typeof CommitNotFetchedError;
|
|
@@ -1068,6 +1069,10 @@ export function checkout({ fs, onProgress, onPostCheckout, dir, gitdir, remote,
|
|
|
1068
1069
|
/**
|
|
1069
1070
|
* Cherry-pick a commit onto the current branch
|
|
1070
1071
|
*
|
|
1072
|
+
* Like `git cherry-pick`, this refuses to run when it would overwrite local changes in the working tree.
|
|
1073
|
+
* If a file the picked commit changes has staged or unstaged changes, or an untracked file is in the way,
|
|
1074
|
+
* a `CherryPickLocalChangesError` listing those files is thrown before anything is written.
|
|
1075
|
+
*
|
|
1071
1076
|
* @param {object} args
|
|
1072
1077
|
* @param {FsClient} args.fs - a file system implementation
|
|
1073
1078
|
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
|
|
@@ -3983,6 +3988,21 @@ declare namespace CheckoutConflictError {
|
|
|
3983
3988
|
let code_2: "CheckoutConflictError";
|
|
3984
3989
|
export { code_2 as code };
|
|
3985
3990
|
}
|
|
3991
|
+
declare class CherryPickLocalChangesError extends BaseError {
|
|
3992
|
+
/**
|
|
3993
|
+
* @param {string[]} filepaths
|
|
3994
|
+
*/
|
|
3995
|
+
constructor(filepaths: string[]);
|
|
3996
|
+
code: "CherryPickLocalChangesError";
|
|
3997
|
+
name: "CherryPickLocalChangesError";
|
|
3998
|
+
data: {
|
|
3999
|
+
filepaths: string[];
|
|
4000
|
+
};
|
|
4001
|
+
}
|
|
4002
|
+
declare namespace CherryPickLocalChangesError {
|
|
4003
|
+
let code_3: "CherryPickLocalChangesError";
|
|
4004
|
+
export { code_3 as code };
|
|
4005
|
+
}
|
|
3986
4006
|
declare class CherryPickMergeCommitError extends BaseError {
|
|
3987
4007
|
/**
|
|
3988
4008
|
* @param {string} oid
|
|
@@ -3997,8 +4017,8 @@ declare class CherryPickMergeCommitError extends BaseError {
|
|
|
3997
4017
|
};
|
|
3998
4018
|
}
|
|
3999
4019
|
declare namespace CherryPickMergeCommitError {
|
|
4000
|
-
let
|
|
4001
|
-
export {
|
|
4020
|
+
let code_4: "CherryPickMergeCommitError";
|
|
4021
|
+
export { code_4 as code };
|
|
4002
4022
|
}
|
|
4003
4023
|
declare class CherryPickRootCommitError extends BaseError {
|
|
4004
4024
|
/**
|
|
@@ -4012,8 +4032,8 @@ declare class CherryPickRootCommitError extends BaseError {
|
|
|
4012
4032
|
};
|
|
4013
4033
|
}
|
|
4014
4034
|
declare namespace CherryPickRootCommitError {
|
|
4015
|
-
let
|
|
4016
|
-
export {
|
|
4035
|
+
let code_5: "CherryPickRootCommitError";
|
|
4036
|
+
export { code_5 as code };
|
|
4017
4037
|
}
|
|
4018
4038
|
declare class CommitNotFetchedError extends BaseError {
|
|
4019
4039
|
/**
|
|
@@ -4029,8 +4049,8 @@ declare class CommitNotFetchedError extends BaseError {
|
|
|
4029
4049
|
};
|
|
4030
4050
|
}
|
|
4031
4051
|
declare namespace CommitNotFetchedError {
|
|
4032
|
-
let
|
|
4033
|
-
export {
|
|
4052
|
+
let code_6: "CommitNotFetchedError";
|
|
4053
|
+
export { code_6 as code };
|
|
4034
4054
|
}
|
|
4035
4055
|
declare class EmptyCommitError extends BaseError {
|
|
4036
4056
|
constructor();
|
|
@@ -4039,8 +4059,8 @@ declare class EmptyCommitError extends BaseError {
|
|
|
4039
4059
|
data: {};
|
|
4040
4060
|
}
|
|
4041
4061
|
declare namespace EmptyCommitError {
|
|
4042
|
-
let
|
|
4043
|
-
export {
|
|
4062
|
+
let code_7: "EmptyCommitError";
|
|
4063
|
+
export { code_7 as code };
|
|
4044
4064
|
}
|
|
4045
4065
|
declare class EmptyServerResponseError extends BaseError {
|
|
4046
4066
|
constructor();
|
|
@@ -4049,8 +4069,8 @@ declare class EmptyServerResponseError extends BaseError {
|
|
|
4049
4069
|
data: {};
|
|
4050
4070
|
}
|
|
4051
4071
|
declare namespace EmptyServerResponseError {
|
|
4052
|
-
let
|
|
4053
|
-
export {
|
|
4072
|
+
let code_8: "EmptyServerResponseError";
|
|
4073
|
+
export { code_8 as code };
|
|
4054
4074
|
}
|
|
4055
4075
|
declare class FastForwardError extends BaseError {
|
|
4056
4076
|
constructor();
|
|
@@ -4059,8 +4079,8 @@ declare class FastForwardError extends BaseError {
|
|
|
4059
4079
|
data: {};
|
|
4060
4080
|
}
|
|
4061
4081
|
declare namespace FastForwardError {
|
|
4062
|
-
let
|
|
4063
|
-
export {
|
|
4082
|
+
let code_9: "FastForwardError";
|
|
4083
|
+
export { code_9 as code };
|
|
4064
4084
|
}
|
|
4065
4085
|
declare class GitPushError extends BaseError {
|
|
4066
4086
|
/**
|
|
@@ -4076,8 +4096,8 @@ declare class GitPushError extends BaseError {
|
|
|
4076
4096
|
};
|
|
4077
4097
|
}
|
|
4078
4098
|
declare namespace GitPushError {
|
|
4079
|
-
let
|
|
4080
|
-
export {
|
|
4099
|
+
let code_10: "GitPushError";
|
|
4100
|
+
export { code_10 as code };
|
|
4081
4101
|
}
|
|
4082
4102
|
declare class HttpError extends BaseError {
|
|
4083
4103
|
/**
|
|
@@ -4095,8 +4115,8 @@ declare class HttpError extends BaseError {
|
|
|
4095
4115
|
};
|
|
4096
4116
|
}
|
|
4097
4117
|
declare namespace HttpError {
|
|
4098
|
-
let
|
|
4099
|
-
export {
|
|
4118
|
+
let code_11: "HttpError";
|
|
4119
|
+
export { code_11 as code };
|
|
4100
4120
|
}
|
|
4101
4121
|
declare class InternalError extends BaseError {
|
|
4102
4122
|
/**
|
|
@@ -4110,8 +4130,8 @@ declare class InternalError extends BaseError {
|
|
|
4110
4130
|
};
|
|
4111
4131
|
}
|
|
4112
4132
|
declare namespace InternalError {
|
|
4113
|
-
let
|
|
4114
|
-
export {
|
|
4133
|
+
let code_12: "InternalError";
|
|
4134
|
+
export { code_12 as code };
|
|
4115
4135
|
}
|
|
4116
4136
|
declare class InvalidFilepathError extends BaseError {
|
|
4117
4137
|
/**
|
|
@@ -4125,8 +4145,8 @@ declare class InvalidFilepathError extends BaseError {
|
|
|
4125
4145
|
};
|
|
4126
4146
|
}
|
|
4127
4147
|
declare namespace InvalidFilepathError {
|
|
4128
|
-
let
|
|
4129
|
-
export {
|
|
4148
|
+
let code_13: "InvalidFilepathError";
|
|
4149
|
+
export { code_13 as code };
|
|
4130
4150
|
}
|
|
4131
4151
|
declare class InvalidOidError extends BaseError {
|
|
4132
4152
|
/**
|
|
@@ -4140,8 +4160,8 @@ declare class InvalidOidError extends BaseError {
|
|
|
4140
4160
|
};
|
|
4141
4161
|
}
|
|
4142
4162
|
declare namespace InvalidOidError {
|
|
4143
|
-
let
|
|
4144
|
-
export {
|
|
4163
|
+
let code_14: "InvalidOidError";
|
|
4164
|
+
export { code_14 as code };
|
|
4145
4165
|
}
|
|
4146
4166
|
declare class InvalidRefNameError extends BaseError {
|
|
4147
4167
|
/**
|
|
@@ -4158,8 +4178,8 @@ declare class InvalidRefNameError extends BaseError {
|
|
|
4158
4178
|
};
|
|
4159
4179
|
}
|
|
4160
4180
|
declare namespace InvalidRefNameError {
|
|
4161
|
-
let
|
|
4162
|
-
export {
|
|
4181
|
+
let code_15: "InvalidRefNameError";
|
|
4182
|
+
export { code_15 as code };
|
|
4163
4183
|
}
|
|
4164
4184
|
declare class MaxDepthError extends BaseError {
|
|
4165
4185
|
/**
|
|
@@ -4173,8 +4193,8 @@ declare class MaxDepthError extends BaseError {
|
|
|
4173
4193
|
};
|
|
4174
4194
|
}
|
|
4175
4195
|
declare namespace MaxDepthError {
|
|
4176
|
-
let
|
|
4177
|
-
export {
|
|
4196
|
+
let code_16: "MaxDepthError";
|
|
4197
|
+
export { code_16 as code };
|
|
4178
4198
|
}
|
|
4179
4199
|
declare class MergeNotSupportedError extends BaseError {
|
|
4180
4200
|
constructor();
|
|
@@ -4183,8 +4203,8 @@ declare class MergeNotSupportedError extends BaseError {
|
|
|
4183
4203
|
data: {};
|
|
4184
4204
|
}
|
|
4185
4205
|
declare namespace MergeNotSupportedError {
|
|
4186
|
-
let
|
|
4187
|
-
export {
|
|
4206
|
+
let code_17: "MergeNotSupportedError";
|
|
4207
|
+
export { code_17 as code };
|
|
4188
4208
|
}
|
|
4189
4209
|
declare class MergeConflictError extends BaseError {
|
|
4190
4210
|
/**
|
|
@@ -4204,8 +4224,8 @@ declare class MergeConflictError extends BaseError {
|
|
|
4204
4224
|
};
|
|
4205
4225
|
}
|
|
4206
4226
|
declare namespace MergeConflictError {
|
|
4207
|
-
let
|
|
4208
|
-
export {
|
|
4227
|
+
let code_18: "MergeConflictError";
|
|
4228
|
+
export { code_18 as code };
|
|
4209
4229
|
}
|
|
4210
4230
|
declare class MissingNameError extends BaseError {
|
|
4211
4231
|
/**
|
|
@@ -4219,8 +4239,8 @@ declare class MissingNameError extends BaseError {
|
|
|
4219
4239
|
};
|
|
4220
4240
|
}
|
|
4221
4241
|
declare namespace MissingNameError {
|
|
4222
|
-
let
|
|
4223
|
-
export {
|
|
4242
|
+
let code_19: "MissingNameError";
|
|
4243
|
+
export { code_19 as code };
|
|
4224
4244
|
}
|
|
4225
4245
|
declare class MissingParameterError extends BaseError {
|
|
4226
4246
|
/**
|
|
@@ -4234,8 +4254,8 @@ declare class MissingParameterError extends BaseError {
|
|
|
4234
4254
|
};
|
|
4235
4255
|
}
|
|
4236
4256
|
declare namespace MissingParameterError {
|
|
4237
|
-
let
|
|
4238
|
-
export {
|
|
4257
|
+
let code_20: "MissingParameterError";
|
|
4258
|
+
export { code_20 as code };
|
|
4239
4259
|
}
|
|
4240
4260
|
declare class MultipleGitError extends BaseError {
|
|
4241
4261
|
/**
|
|
@@ -4251,8 +4271,8 @@ declare class MultipleGitError extends BaseError {
|
|
|
4251
4271
|
errors: Error[];
|
|
4252
4272
|
}
|
|
4253
4273
|
declare namespace MultipleGitError {
|
|
4254
|
-
let
|
|
4255
|
-
export {
|
|
4274
|
+
let code_21: "MultipleGitError";
|
|
4275
|
+
export { code_21 as code };
|
|
4256
4276
|
}
|
|
4257
4277
|
declare class NoRefspecError extends BaseError {
|
|
4258
4278
|
/**
|
|
@@ -4266,8 +4286,8 @@ declare class NoRefspecError extends BaseError {
|
|
|
4266
4286
|
};
|
|
4267
4287
|
}
|
|
4268
4288
|
declare namespace NoRefspecError {
|
|
4269
|
-
let
|
|
4270
|
-
export {
|
|
4289
|
+
let code_22: "NoRefspecError";
|
|
4290
|
+
export { code_22 as code };
|
|
4271
4291
|
}
|
|
4272
4292
|
declare class NotFoundError extends BaseError {
|
|
4273
4293
|
/**
|
|
@@ -4281,8 +4301,8 @@ declare class NotFoundError extends BaseError {
|
|
|
4281
4301
|
};
|
|
4282
4302
|
}
|
|
4283
4303
|
declare namespace NotFoundError {
|
|
4284
|
-
let
|
|
4285
|
-
export {
|
|
4304
|
+
let code_23: "NotFoundError";
|
|
4305
|
+
export { code_23 as code };
|
|
4286
4306
|
}
|
|
4287
4307
|
declare class ObjectTypeError extends BaseError {
|
|
4288
4308
|
/**
|
|
@@ -4302,8 +4322,8 @@ declare class ObjectTypeError extends BaseError {
|
|
|
4302
4322
|
};
|
|
4303
4323
|
}
|
|
4304
4324
|
declare namespace ObjectTypeError {
|
|
4305
|
-
let
|
|
4306
|
-
export {
|
|
4325
|
+
let code_24: "ObjectTypeError";
|
|
4326
|
+
export { code_24 as code };
|
|
4307
4327
|
}
|
|
4308
4328
|
declare class ParseError extends BaseError {
|
|
4309
4329
|
/**
|
|
@@ -4319,8 +4339,8 @@ declare class ParseError extends BaseError {
|
|
|
4319
4339
|
};
|
|
4320
4340
|
}
|
|
4321
4341
|
declare namespace ParseError {
|
|
4322
|
-
let
|
|
4323
|
-
export {
|
|
4342
|
+
let code_25: "ParseError";
|
|
4343
|
+
export { code_25 as code };
|
|
4324
4344
|
}
|
|
4325
4345
|
declare class PushRejectedError extends BaseError {
|
|
4326
4346
|
/**
|
|
@@ -4334,8 +4354,8 @@ declare class PushRejectedError extends BaseError {
|
|
|
4334
4354
|
};
|
|
4335
4355
|
}
|
|
4336
4356
|
declare namespace PushRejectedError {
|
|
4337
|
-
let
|
|
4338
|
-
export {
|
|
4357
|
+
let code_26: "PushRejectedError";
|
|
4358
|
+
export { code_26 as code };
|
|
4339
4359
|
}
|
|
4340
4360
|
declare class RemoteCapabilityError extends BaseError {
|
|
4341
4361
|
/**
|
|
@@ -4351,8 +4371,8 @@ declare class RemoteCapabilityError extends BaseError {
|
|
|
4351
4371
|
};
|
|
4352
4372
|
}
|
|
4353
4373
|
declare namespace RemoteCapabilityError {
|
|
4354
|
-
let
|
|
4355
|
-
export {
|
|
4374
|
+
let code_27: "RemoteCapabilityError";
|
|
4375
|
+
export { code_27 as code };
|
|
4356
4376
|
}
|
|
4357
4377
|
declare class SmartHttpError extends BaseError {
|
|
4358
4378
|
/**
|
|
@@ -4368,8 +4388,8 @@ declare class SmartHttpError extends BaseError {
|
|
|
4368
4388
|
};
|
|
4369
4389
|
}
|
|
4370
4390
|
declare namespace SmartHttpError {
|
|
4371
|
-
let
|
|
4372
|
-
export {
|
|
4391
|
+
let code_28: "SmartHttpError";
|
|
4392
|
+
export { code_28 as code };
|
|
4373
4393
|
}
|
|
4374
4394
|
declare class UnknownTransportError extends BaseError {
|
|
4375
4395
|
/**
|
|
@@ -4387,8 +4407,8 @@ declare class UnknownTransportError extends BaseError {
|
|
|
4387
4407
|
};
|
|
4388
4408
|
}
|
|
4389
4409
|
declare namespace UnknownTransportError {
|
|
4390
|
-
let
|
|
4391
|
-
export {
|
|
4410
|
+
let code_29: "UnknownTransportError";
|
|
4411
|
+
export { code_29 as code };
|
|
4392
4412
|
}
|
|
4393
4413
|
declare class UnsafeFilepathError extends BaseError {
|
|
4394
4414
|
/**
|
|
@@ -4402,8 +4422,8 @@ declare class UnsafeFilepathError extends BaseError {
|
|
|
4402
4422
|
};
|
|
4403
4423
|
}
|
|
4404
4424
|
declare namespace UnsafeFilepathError {
|
|
4405
|
-
let
|
|
4406
|
-
export {
|
|
4425
|
+
let code_30: "UnsafeFilepathError";
|
|
4426
|
+
export { code_30 as code };
|
|
4407
4427
|
}
|
|
4408
4428
|
declare class UrlParseError extends BaseError {
|
|
4409
4429
|
/**
|
|
@@ -4417,8 +4437,8 @@ declare class UrlParseError extends BaseError {
|
|
|
4417
4437
|
};
|
|
4418
4438
|
}
|
|
4419
4439
|
declare namespace UrlParseError {
|
|
4420
|
-
let
|
|
4421
|
-
export {
|
|
4440
|
+
let code_31: "UrlParseError";
|
|
4441
|
+
export { code_31 as code };
|
|
4422
4442
|
}
|
|
4423
4443
|
declare class UserCanceledError extends BaseError {
|
|
4424
4444
|
constructor();
|
|
@@ -4427,8 +4447,8 @@ declare class UserCanceledError extends BaseError {
|
|
|
4427
4447
|
data: {};
|
|
4428
4448
|
}
|
|
4429
4449
|
declare namespace UserCanceledError {
|
|
4430
|
-
let
|
|
4431
|
-
export {
|
|
4450
|
+
let code_32: "UserCanceledError";
|
|
4451
|
+
export { code_32 as code };
|
|
4432
4452
|
}
|
|
4433
4453
|
declare class UnmergedPathsError extends BaseError {
|
|
4434
4454
|
/**
|
|
@@ -4442,8 +4462,8 @@ declare class UnmergedPathsError extends BaseError {
|
|
|
4442
4462
|
};
|
|
4443
4463
|
}
|
|
4444
4464
|
declare namespace UnmergedPathsError {
|
|
4445
|
-
let
|
|
4446
|
-
export {
|
|
4465
|
+
let code_33: "UnmergedPathsError";
|
|
4466
|
+
export { code_33 as code };
|
|
4447
4467
|
}
|
|
4448
4468
|
declare class IndexResetError extends BaseError {
|
|
4449
4469
|
/**
|
|
@@ -4457,8 +4477,8 @@ declare class IndexResetError extends BaseError {
|
|
|
4457
4477
|
};
|
|
4458
4478
|
}
|
|
4459
4479
|
declare namespace IndexResetError {
|
|
4460
|
-
let
|
|
4461
|
-
export {
|
|
4480
|
+
let code_34: "IndexResetError";
|
|
4481
|
+
export { code_34 as code };
|
|
4462
4482
|
}
|
|
4463
4483
|
declare class NoCommitError extends BaseError {
|
|
4464
4484
|
/**
|
|
@@ -4472,8 +4492,8 @@ declare class NoCommitError extends BaseError {
|
|
|
4472
4492
|
};
|
|
4473
4493
|
}
|
|
4474
4494
|
declare namespace NoCommitError {
|
|
4475
|
-
let
|
|
4476
|
-
export {
|
|
4495
|
+
let code_35: "NoCommitError";
|
|
4496
|
+
export { code_35 as code };
|
|
4477
4497
|
}
|
|
4478
4498
|
/**
|
|
4479
4499
|
* @typedef {Object} GitProgressEvent
|
package/index.js
CHANGED
|
@@ -1087,7 +1087,16 @@ async function isIndexStale(fs, filepath, cache) {
|
|
|
1087
1087
|
|
|
1088
1088
|
const currStats = await fs.lstat(filepath);
|
|
1089
1089
|
if (currStats === null) return false
|
|
1090
|
-
|
|
1090
|
+
if (compareStats(savedStats, currStats)) return true
|
|
1091
|
+
// compareStats only looks at whole seconds, but the index is often rewritten
|
|
1092
|
+
// in the same second with the same size (an entry got a new oid). Both stats
|
|
1093
|
+
// come from the same fs, so compare the full timestamps too.
|
|
1094
|
+
const saved = normalizeStats(savedStats);
|
|
1095
|
+
const curr = normalizeStats(currStats);
|
|
1096
|
+
return (
|
|
1097
|
+
saved.mtimeNanoseconds !== curr.mtimeNanoseconds ||
|
|
1098
|
+
saved.ctimeNanoseconds !== curr.ctimeNanoseconds
|
|
1099
|
+
)
|
|
1091
1100
|
}
|
|
1092
1101
|
|
|
1093
1102
|
class GitIndexManager {
|
|
@@ -3875,6 +3884,23 @@ class CheckoutConflictError extends BaseError {
|
|
|
3875
3884
|
/** @type {'CheckoutConflictError'} */
|
|
3876
3885
|
CheckoutConflictError.code = 'CheckoutConflictError';
|
|
3877
3886
|
|
|
3887
|
+
class CherryPickLocalChangesError extends BaseError {
|
|
3888
|
+
/**
|
|
3889
|
+
* @param {string[]} filepaths
|
|
3890
|
+
*/
|
|
3891
|
+
constructor(filepaths) {
|
|
3892
|
+
super(
|
|
3893
|
+
`Your local changes to the following files would be overwritten by cherry-pick: ${filepaths.join(
|
|
3894
|
+
', '
|
|
3895
|
+
)}`
|
|
3896
|
+
);
|
|
3897
|
+
this.code = this.name = CherryPickLocalChangesError.code;
|
|
3898
|
+
this.data = { filepaths };
|
|
3899
|
+
}
|
|
3900
|
+
}
|
|
3901
|
+
/** @type {'CherryPickLocalChangesError'} */
|
|
3902
|
+
CherryPickLocalChangesError.code = 'CherryPickLocalChangesError';
|
|
3903
|
+
|
|
3878
3904
|
class CherryPickMergeCommitError extends BaseError {
|
|
3879
3905
|
/**
|
|
3880
3906
|
* @param {string} oid
|
|
@@ -4231,6 +4257,7 @@ var Errors = /*#__PURE__*/Object.freeze({
|
|
|
4231
4257
|
AlreadyExistsError: AlreadyExistsError,
|
|
4232
4258
|
AmbiguousError: AmbiguousError,
|
|
4233
4259
|
CheckoutConflictError: CheckoutConflictError,
|
|
4260
|
+
CherryPickLocalChangesError: CherryPickLocalChangesError,
|
|
4234
4261
|
CherryPickMergeCommitError: CherryPickMergeCommitError,
|
|
4235
4262
|
CherryPickRootCommitError: CherryPickRootCommitError,
|
|
4236
4263
|
CommitNotFetchedError: CommitNotFetchedError,
|
|
@@ -4793,6 +4820,10 @@ class GitWalkerFs {
|
|
|
4793
4820
|
this.dir = dir;
|
|
4794
4821
|
this.gitdir = gitdir;
|
|
4795
4822
|
this.refresh = refresh;
|
|
4823
|
+
// Index entries whose stat info needs a refresh. `flush` writes them to
|
|
4824
|
+
// the index together when the walk is finished.
|
|
4825
|
+
this.refreshQueue = [];
|
|
4826
|
+
this.flushed = false;
|
|
4796
4827
|
|
|
4797
4828
|
this.config = null;
|
|
4798
4829
|
const walker = this;
|
|
@@ -4937,11 +4968,20 @@ class GitWalkerFs {
|
|
|
4937
4968
|
(!filemode || stats.mode === stage.mode) &&
|
|
4938
4969
|
compareStats(stats, stage, filemode, trustino)
|
|
4939
4970
|
) {
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
oid
|
|
4944
|
-
}
|
|
4971
|
+
if (self.flushed) {
|
|
4972
|
+
// The walk is finished and `flush` already ran, so write
|
|
4973
|
+
// it right away.
|
|
4974
|
+
index.insert({ filepath: entry._fullpath, stats, oid });
|
|
4975
|
+
} else {
|
|
4976
|
+
// Queue the refresh so `flush` can write all of them to the
|
|
4977
|
+
// index in one go when the walk is finished.
|
|
4978
|
+
self.refreshQueue.push({
|
|
4979
|
+
filepath: entry._fullpath,
|
|
4980
|
+
stage,
|
|
4981
|
+
stats,
|
|
4982
|
+
oid,
|
|
4983
|
+
});
|
|
4984
|
+
}
|
|
4945
4985
|
}
|
|
4946
4986
|
}
|
|
4947
4987
|
} else {
|
|
@@ -4955,6 +4995,26 @@ class GitWalkerFs {
|
|
|
4955
4995
|
return entry._oid
|
|
4956
4996
|
}
|
|
4957
4997
|
|
|
4998
|
+
/**
|
|
4999
|
+
* Write the queued stat refreshes to the index in a single pass.
|
|
5000
|
+
* `_walk` calls this once the walk is finished. The entries it returned
|
|
5001
|
+
* can still be asked for their oid afterwards, so from then on `oid`
|
|
5002
|
+
* writes a refresh right away instead of queueing it.
|
|
5003
|
+
*/
|
|
5004
|
+
async flush() {
|
|
5005
|
+
const { fs, gitdir, cache, refreshQueue } = this;
|
|
5006
|
+
this.refreshQueue = [];
|
|
5007
|
+
this.flushed = true;
|
|
5008
|
+
if (refreshQueue.length === 0) return
|
|
5009
|
+
await GitIndexManager.acquire({ fs, gitdir, cache }, async index => {
|
|
5010
|
+
for (const { filepath, stage, stats, oid } of refreshQueue) {
|
|
5011
|
+
// Only refresh entries that are still the ones we looked at.
|
|
5012
|
+
if (index.entriesMap.get(filepath) !== stage) continue
|
|
5013
|
+
index.insert({ filepath, stats, oid });
|
|
5014
|
+
}
|
|
5015
|
+
});
|
|
5016
|
+
}
|
|
5017
|
+
|
|
4958
5018
|
async _getGitConfig(fs, gitdir) {
|
|
4959
5019
|
if (this.config) {
|
|
4960
5020
|
return this.config
|
|
@@ -5152,7 +5212,13 @@ async function _walk({
|
|
|
5152
5212
|
return reduce(parent, walkedChildren)
|
|
5153
5213
|
}
|
|
5154
5214
|
};
|
|
5155
|
-
|
|
5215
|
+
const result = await walk(root);
|
|
5216
|
+
// Let walkers write out what they queued during the walk. WORKDIR queues
|
|
5217
|
+
// its index stat refreshes so the index is written once at the end.
|
|
5218
|
+
for (const walker of walkers) {
|
|
5219
|
+
if (walker.flush) await walker.flush();
|
|
5220
|
+
}
|
|
5221
|
+
return result
|
|
5156
5222
|
}
|
|
5157
5223
|
|
|
5158
5224
|
/**
|
|
@@ -8864,6 +8930,27 @@ async function _cherryPick({
|
|
|
8864
8930
|
oid: cherryParentOid,
|
|
8865
8931
|
});
|
|
8866
8932
|
|
|
8933
|
+
// The working tree is rewritten after a successful cherry-pick, and also when
|
|
8934
|
+
// conflicts are written out. Like `git cherry-pick`, refuse to start if that
|
|
8935
|
+
// would overwrite local changes to the files the picked commit touches.
|
|
8936
|
+
// Writing out conflicts rewrites every tracked file, so in that mode any local
|
|
8937
|
+
// change to a tracked file is in the way.
|
|
8938
|
+
if (dir && ((!dryRun && !noUpdateBranch) || !abortOnConflict)) {
|
|
8939
|
+
const filepaths = await findLocalChanges({
|
|
8940
|
+
fs,
|
|
8941
|
+
cache,
|
|
8942
|
+
dir,
|
|
8943
|
+
gitdir,
|
|
8944
|
+
headTree: currentCommit.tree,
|
|
8945
|
+
baseTree: cherryParent.tree,
|
|
8946
|
+
theirTree: cherryCommit.tree,
|
|
8947
|
+
allTracked: !abortOnConflict,
|
|
8948
|
+
});
|
|
8949
|
+
if (filepaths.length > 0) {
|
|
8950
|
+
throw new CherryPickLocalChangesError(filepaths)
|
|
8951
|
+
}
|
|
8952
|
+
}
|
|
8953
|
+
|
|
8867
8954
|
// Three-way merge
|
|
8868
8955
|
// - ourOid: current HEAD tree
|
|
8869
8956
|
// - baseOid: parent of commit being cherry-picked
|
|
@@ -8926,11 +9013,96 @@ async function _cherryPick({
|
|
|
8926
9013
|
return newOid
|
|
8927
9014
|
}
|
|
8928
9015
|
|
|
9016
|
+
/**
|
|
9017
|
+
* Lists the files changed between `baseTree` and `theirTree` whose index or
|
|
9018
|
+
* working tree copy differs from `headTree`, including untracked files that
|
|
9019
|
+
* would be replaced. With `allTracked`, every file tracked in `headTree` is
|
|
9020
|
+
* checked as well.
|
|
9021
|
+
*
|
|
9022
|
+
* @param {object} args
|
|
9023
|
+
* @param {import('../models/FileSystem.js').FileSystem} args.fs
|
|
9024
|
+
* @param {object} args.cache
|
|
9025
|
+
* @param {string} args.dir
|
|
9026
|
+
* @param {string} args.gitdir
|
|
9027
|
+
* @param {string} args.headTree
|
|
9028
|
+
* @param {string} args.baseTree
|
|
9029
|
+
* @param {string} args.theirTree
|
|
9030
|
+
* @param {boolean} args.allTracked
|
|
9031
|
+
*
|
|
9032
|
+
* @returns {Promise<string[]>}
|
|
9033
|
+
*/
|
|
9034
|
+
async function findLocalChanges({
|
|
9035
|
+
fs,
|
|
9036
|
+
cache,
|
|
9037
|
+
dir,
|
|
9038
|
+
gitdir,
|
|
9039
|
+
headTree,
|
|
9040
|
+
baseTree,
|
|
9041
|
+
theirTree,
|
|
9042
|
+
allTracked,
|
|
9043
|
+
}) {
|
|
9044
|
+
/** @type {string[]} */
|
|
9045
|
+
const changed = await _walk({
|
|
9046
|
+
fs,
|
|
9047
|
+
cache,
|
|
9048
|
+
dir,
|
|
9049
|
+
gitdir,
|
|
9050
|
+
trees: [TREE({ ref: baseTree }), TREE({ ref: theirTree })],
|
|
9051
|
+
map: async (filepath, [base, their]) => {
|
|
9052
|
+
if (filepath === '.') return
|
|
9053
|
+
if (base && their && (await base.oid()) === (await their.oid())) {
|
|
9054
|
+
return null
|
|
9055
|
+
}
|
|
9056
|
+
const types = [
|
|
9057
|
+
base ? await base.type() : undefined,
|
|
9058
|
+
their ? await their.type() : undefined,
|
|
9059
|
+
];
|
|
9060
|
+
if (types.includes('blob')) return filepath
|
|
9061
|
+
},
|
|
9062
|
+
});
|
|
9063
|
+
if (changed.length === 0 && !allTracked) return []
|
|
9064
|
+
|
|
9065
|
+
return _walk({
|
|
9066
|
+
fs,
|
|
9067
|
+
cache,
|
|
9068
|
+
dir,
|
|
9069
|
+
gitdir,
|
|
9070
|
+
trees: [TREE({ ref: headTree }), STAGE(), WORKDIR()],
|
|
9071
|
+
map: async (filepath, [head, stage, workdir]) => {
|
|
9072
|
+
if (filepath === '.') return
|
|
9073
|
+
if (!allTracked && !changed.some(path => worthWalking(filepath, path))) {
|
|
9074
|
+
return null
|
|
9075
|
+
}
|
|
9076
|
+
const headOid =
|
|
9077
|
+
head && (await head.type()) === 'blob' ? await head.oid() : undefined;
|
|
9078
|
+
if (!changed.includes(filepath) && !(allTracked && headOid)) return
|
|
9079
|
+
|
|
9080
|
+
const stageOid = stage ? await stage.oid() : undefined;
|
|
9081
|
+
// Staged changes would be replaced by the cherry-picked version.
|
|
9082
|
+
if (stageOid !== headOid) return filepath
|
|
9083
|
+
// A file missing from the working tree has nothing to lose.
|
|
9084
|
+
if (!workdir) return
|
|
9085
|
+
// Untracked files, directories in the way, and unstaged edits.
|
|
9086
|
+
if (
|
|
9087
|
+
!headOid ||
|
|
9088
|
+
(await workdir.type()) !== 'blob' ||
|
|
9089
|
+
(await workdir.oid()) !== headOid
|
|
9090
|
+
) {
|
|
9091
|
+
return filepath
|
|
9092
|
+
}
|
|
9093
|
+
},
|
|
9094
|
+
})
|
|
9095
|
+
}
|
|
9096
|
+
|
|
8929
9097
|
// @ts-check
|
|
8930
9098
|
|
|
8931
9099
|
/**
|
|
8932
9100
|
* Cherry-pick a commit onto the current branch
|
|
8933
9101
|
*
|
|
9102
|
+
* Like `git cherry-pick`, this refuses to run when it would overwrite local changes in the working tree.
|
|
9103
|
+
* If a file the picked commit changes has staged or unstaged changes, or an untracked file is in the way,
|
|
9104
|
+
* a `CherryPickLocalChangesError` listing those files is thrown before anything is written.
|
|
9105
|
+
*
|
|
8934
9106
|
* @param {object} args
|
|
8935
9107
|
* @param {FsClient} args.fs - a file system implementation
|
|
8936
9108
|
* @param {string} [args.dir] - The [working tree](dir-vs-gitdir.md) directory path
|
|
@@ -9838,8 +10010,8 @@ function filterCapabilities(server, client) {
|
|
|
9838
10010
|
|
|
9839
10011
|
const pkg = {
|
|
9840
10012
|
name: 'isomorphic-git',
|
|
9841
|
-
version: '1.42.
|
|
9842
|
-
agent: 'git/isomorphic-git@1.42.
|
|
10013
|
+
version: '1.42.7',
|
|
10014
|
+
agent: 'git/isomorphic-git@1.42.7',
|
|
9843
10015
|
};
|
|
9844
10016
|
|
|
9845
10017
|
class FIFO {
|