isomorphic-git 1.38.10 → 1.40.0
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/index.cjs +83 -3
- package/index.d.cts +78 -58
- package/index.d.ts +78 -58
- package/index.js +83 -3
- package/index.umd.min.d.ts +78 -58
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +11 -0
- package/managers/index.d.cts +4 -0
- package/managers/index.d.ts +4 -0
- package/managers/index.js +11 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -353,6 +353,10 @@ export type CommitObject = {
|
|
|
353
353
|
* an array of zero or more SHA-1 object ids
|
|
354
354
|
*/
|
|
355
355
|
parent: string[];
|
|
356
|
+
/**
|
|
357
|
+
* Changed files as `[newOid, oldOid, filepath]`; present when `log` is called with `includeChanges: true`.
|
|
358
|
+
*/
|
|
359
|
+
changes?: (string | null)[][] | undefined;
|
|
356
360
|
author: {
|
|
357
361
|
name: string;
|
|
358
362
|
email: string;
|
|
@@ -705,6 +709,7 @@ export var Errors: Readonly<{
|
|
|
705
709
|
CherryPickMergeCommitError: typeof CherryPickMergeCommitError;
|
|
706
710
|
CherryPickRootCommitError: typeof CherryPickRootCommitError;
|
|
707
711
|
CommitNotFetchedError: typeof CommitNotFetchedError;
|
|
712
|
+
EmptyCommitError: typeof EmptyCommitError;
|
|
708
713
|
EmptyServerResponseError: typeof EmptyServerResponseError;
|
|
709
714
|
FastForwardError: typeof FastForwardError;
|
|
710
715
|
GitPushError: typeof GitPushError;
|
|
@@ -1200,6 +1205,7 @@ export function clone({ fs, http, onProgress, onMessage, onAuth, onAuthSuccess,
|
|
|
1200
1205
|
* @param {boolean} [args.amend = false] - If true, replaces the last commit pointed to by `ref` with a new commit.
|
|
1201
1206
|
* @param {boolean} [args.dryRun = false] - If true, simulates making a commit so you can test whether it would succeed. Implies `noUpdateBranch`.
|
|
1202
1207
|
* @param {boolean} [args.noUpdateBranch = false] - If true, does not update the branch pointer after creating the commit.
|
|
1208
|
+
* @param {boolean} [args.disallowEmpty = false] - If true, throws an error instead of creating a commit with no staged changes.
|
|
1203
1209
|
* @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.)
|
|
1204
1210
|
* @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.
|
|
1205
1211
|
* @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.
|
|
@@ -1220,7 +1226,7 @@ export function clone({ fs, http, onProgress, onMessage, onAuth, onAuthSuccess,
|
|
|
1220
1226
|
* console.log(sha)
|
|
1221
1227
|
*
|
|
1222
1228
|
*/
|
|
1223
|
-
export function commit({ fs: _fs, onSign, dir, gitdir, message, author, committer, signingKey, amend, dryRun, noUpdateBranch, ref, parent, tree, cache, }: {
|
|
1229
|
+
export function commit({ fs: _fs, onSign, dir, gitdir, message, author, committer, signingKey, amend, dryRun, noUpdateBranch, disallowEmpty, ref, parent, tree, cache, }: {
|
|
1224
1230
|
fs: FsClient;
|
|
1225
1231
|
onSign?: SignCallback | undefined;
|
|
1226
1232
|
dir?: string | undefined;
|
|
@@ -1242,6 +1248,7 @@ export function commit({ fs: _fs, onSign, dir, gitdir, message, author, committe
|
|
|
1242
1248
|
amend?: boolean | undefined;
|
|
1243
1249
|
dryRun?: boolean | undefined;
|
|
1244
1250
|
noUpdateBranch?: boolean | undefined;
|
|
1251
|
+
disallowEmpty?: boolean | undefined;
|
|
1245
1252
|
ref?: string | undefined;
|
|
1246
1253
|
parent?: string[] | undefined;
|
|
1247
1254
|
tree?: string | undefined;
|
|
@@ -2177,6 +2184,7 @@ export function listTags({ fs, dir, gitdir }: {
|
|
|
2177
2184
|
* @param {Date} [args.since] - Return history newer than the given date. Can be combined with `depth` to get whichever is shorter.
|
|
2178
2185
|
* @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
|
|
2179
2186
|
* @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
|
|
2187
|
+
* @param {boolean=} [args.includeChanges=false] Include changed file object ids for each commit. Each tuple is `[newOid, oldOid, filepath]`; an added or removed file has a null old or new oid, respectively.
|
|
2180
2188
|
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
2181
2189
|
*
|
|
2182
2190
|
* @returns {Promise<Array<ReadCommitResult>>} Resolves to an array of ReadCommitResult objects
|
|
@@ -2193,7 +2201,7 @@ export function listTags({ fs, dir, gitdir }: {
|
|
|
2193
2201
|
* console.log(commits)
|
|
2194
2202
|
*
|
|
2195
2203
|
*/
|
|
2196
|
-
export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follow, cache, }: {
|
|
2204
|
+
export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follow, includeChanges, cache, }: {
|
|
2197
2205
|
fs: FsClient;
|
|
2198
2206
|
dir?: string | undefined;
|
|
2199
2207
|
gitdir?: string | undefined;
|
|
@@ -2203,6 +2211,7 @@ export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follo
|
|
|
2203
2211
|
since?: Date | undefined;
|
|
2204
2212
|
force?: boolean | undefined;
|
|
2205
2213
|
follow?: boolean | undefined;
|
|
2214
|
+
includeChanges?: boolean | undefined;
|
|
2206
2215
|
cache?: object;
|
|
2207
2216
|
}): Promise<Array<ReadCommitResult>>;
|
|
2208
2217
|
/**
|
|
@@ -4028,6 +4037,16 @@ declare namespace CommitNotFetchedError {
|
|
|
4028
4037
|
let code_5: "CommitNotFetchedError";
|
|
4029
4038
|
export { code_5 as code };
|
|
4030
4039
|
}
|
|
4040
|
+
declare class EmptyCommitError extends BaseError {
|
|
4041
|
+
constructor();
|
|
4042
|
+
code: "EmptyCommitError";
|
|
4043
|
+
name: "EmptyCommitError";
|
|
4044
|
+
data: {};
|
|
4045
|
+
}
|
|
4046
|
+
declare namespace EmptyCommitError {
|
|
4047
|
+
let code_6: "EmptyCommitError";
|
|
4048
|
+
export { code_6 as code };
|
|
4049
|
+
}
|
|
4031
4050
|
declare class EmptyServerResponseError extends BaseError {
|
|
4032
4051
|
constructor();
|
|
4033
4052
|
code: "EmptyServerResponseError";
|
|
@@ -4035,8 +4054,8 @@ declare class EmptyServerResponseError extends BaseError {
|
|
|
4035
4054
|
data: {};
|
|
4036
4055
|
}
|
|
4037
4056
|
declare namespace EmptyServerResponseError {
|
|
4038
|
-
let
|
|
4039
|
-
export {
|
|
4057
|
+
let code_7: "EmptyServerResponseError";
|
|
4058
|
+
export { code_7 as code };
|
|
4040
4059
|
}
|
|
4041
4060
|
declare class FastForwardError extends BaseError {
|
|
4042
4061
|
constructor();
|
|
@@ -4045,8 +4064,8 @@ declare class FastForwardError extends BaseError {
|
|
|
4045
4064
|
data: {};
|
|
4046
4065
|
}
|
|
4047
4066
|
declare namespace FastForwardError {
|
|
4048
|
-
let
|
|
4049
|
-
export {
|
|
4067
|
+
let code_8: "FastForwardError";
|
|
4068
|
+
export { code_8 as code };
|
|
4050
4069
|
}
|
|
4051
4070
|
declare class GitPushError extends BaseError {
|
|
4052
4071
|
/**
|
|
@@ -4062,8 +4081,8 @@ declare class GitPushError extends BaseError {
|
|
|
4062
4081
|
};
|
|
4063
4082
|
}
|
|
4064
4083
|
declare namespace GitPushError {
|
|
4065
|
-
let
|
|
4066
|
-
export {
|
|
4084
|
+
let code_9: "GitPushError";
|
|
4085
|
+
export { code_9 as code };
|
|
4067
4086
|
}
|
|
4068
4087
|
declare class HttpError extends BaseError {
|
|
4069
4088
|
/**
|
|
@@ -4081,8 +4100,8 @@ declare class HttpError extends BaseError {
|
|
|
4081
4100
|
};
|
|
4082
4101
|
}
|
|
4083
4102
|
declare namespace HttpError {
|
|
4084
|
-
let
|
|
4085
|
-
export {
|
|
4103
|
+
let code_10: "HttpError";
|
|
4104
|
+
export { code_10 as code };
|
|
4086
4105
|
}
|
|
4087
4106
|
declare class InternalError extends BaseError {
|
|
4088
4107
|
/**
|
|
@@ -4096,8 +4115,8 @@ declare class InternalError extends BaseError {
|
|
|
4096
4115
|
};
|
|
4097
4116
|
}
|
|
4098
4117
|
declare namespace InternalError {
|
|
4099
|
-
let
|
|
4100
|
-
export {
|
|
4118
|
+
let code_11: "InternalError";
|
|
4119
|
+
export { code_11 as code };
|
|
4101
4120
|
}
|
|
4102
4121
|
declare class InvalidFilepathError extends BaseError {
|
|
4103
4122
|
/**
|
|
@@ -4111,8 +4130,8 @@ declare class InvalidFilepathError extends BaseError {
|
|
|
4111
4130
|
};
|
|
4112
4131
|
}
|
|
4113
4132
|
declare namespace InvalidFilepathError {
|
|
4114
|
-
let
|
|
4115
|
-
export {
|
|
4133
|
+
let code_12: "InvalidFilepathError";
|
|
4134
|
+
export { code_12 as code };
|
|
4116
4135
|
}
|
|
4117
4136
|
declare class InvalidOidError extends BaseError {
|
|
4118
4137
|
/**
|
|
@@ -4126,8 +4145,8 @@ declare class InvalidOidError extends BaseError {
|
|
|
4126
4145
|
};
|
|
4127
4146
|
}
|
|
4128
4147
|
declare namespace InvalidOidError {
|
|
4129
|
-
let
|
|
4130
|
-
export {
|
|
4148
|
+
let code_13: "InvalidOidError";
|
|
4149
|
+
export { code_13 as code };
|
|
4131
4150
|
}
|
|
4132
4151
|
declare class InvalidRefNameError extends BaseError {
|
|
4133
4152
|
/**
|
|
@@ -4144,8 +4163,8 @@ declare class InvalidRefNameError extends BaseError {
|
|
|
4144
4163
|
};
|
|
4145
4164
|
}
|
|
4146
4165
|
declare namespace InvalidRefNameError {
|
|
4147
|
-
let
|
|
4148
|
-
export {
|
|
4166
|
+
let code_14: "InvalidRefNameError";
|
|
4167
|
+
export { code_14 as code };
|
|
4149
4168
|
}
|
|
4150
4169
|
declare class MaxDepthError extends BaseError {
|
|
4151
4170
|
/**
|
|
@@ -4159,8 +4178,8 @@ declare class MaxDepthError extends BaseError {
|
|
|
4159
4178
|
};
|
|
4160
4179
|
}
|
|
4161
4180
|
declare namespace MaxDepthError {
|
|
4162
|
-
let
|
|
4163
|
-
export {
|
|
4181
|
+
let code_15: "MaxDepthError";
|
|
4182
|
+
export { code_15 as code };
|
|
4164
4183
|
}
|
|
4165
4184
|
declare class MergeNotSupportedError extends BaseError {
|
|
4166
4185
|
constructor();
|
|
@@ -4169,8 +4188,8 @@ declare class MergeNotSupportedError extends BaseError {
|
|
|
4169
4188
|
data: {};
|
|
4170
4189
|
}
|
|
4171
4190
|
declare namespace MergeNotSupportedError {
|
|
4172
|
-
let
|
|
4173
|
-
export {
|
|
4191
|
+
let code_16: "MergeNotSupportedError";
|
|
4192
|
+
export { code_16 as code };
|
|
4174
4193
|
}
|
|
4175
4194
|
declare class MergeConflictError extends BaseError {
|
|
4176
4195
|
/**
|
|
@@ -4190,8 +4209,8 @@ declare class MergeConflictError extends BaseError {
|
|
|
4190
4209
|
};
|
|
4191
4210
|
}
|
|
4192
4211
|
declare namespace MergeConflictError {
|
|
4193
|
-
let
|
|
4194
|
-
export {
|
|
4212
|
+
let code_17: "MergeConflictError";
|
|
4213
|
+
export { code_17 as code };
|
|
4195
4214
|
}
|
|
4196
4215
|
declare class MissingNameError extends BaseError {
|
|
4197
4216
|
/**
|
|
@@ -4205,8 +4224,8 @@ declare class MissingNameError extends BaseError {
|
|
|
4205
4224
|
};
|
|
4206
4225
|
}
|
|
4207
4226
|
declare namespace MissingNameError {
|
|
4208
|
-
let
|
|
4209
|
-
export {
|
|
4227
|
+
let code_18: "MissingNameError";
|
|
4228
|
+
export { code_18 as code };
|
|
4210
4229
|
}
|
|
4211
4230
|
declare class MissingParameterError extends BaseError {
|
|
4212
4231
|
/**
|
|
@@ -4220,8 +4239,8 @@ declare class MissingParameterError extends BaseError {
|
|
|
4220
4239
|
};
|
|
4221
4240
|
}
|
|
4222
4241
|
declare namespace MissingParameterError {
|
|
4223
|
-
let
|
|
4224
|
-
export {
|
|
4242
|
+
let code_19: "MissingParameterError";
|
|
4243
|
+
export { code_19 as code };
|
|
4225
4244
|
}
|
|
4226
4245
|
declare class MultipleGitError extends BaseError {
|
|
4227
4246
|
/**
|
|
@@ -4237,8 +4256,8 @@ declare class MultipleGitError extends BaseError {
|
|
|
4237
4256
|
errors: Error[];
|
|
4238
4257
|
}
|
|
4239
4258
|
declare namespace MultipleGitError {
|
|
4240
|
-
let
|
|
4241
|
-
export {
|
|
4259
|
+
let code_20: "MultipleGitError";
|
|
4260
|
+
export { code_20 as code };
|
|
4242
4261
|
}
|
|
4243
4262
|
declare class NoRefspecError extends BaseError {
|
|
4244
4263
|
/**
|
|
@@ -4252,8 +4271,8 @@ declare class NoRefspecError extends BaseError {
|
|
|
4252
4271
|
};
|
|
4253
4272
|
}
|
|
4254
4273
|
declare namespace NoRefspecError {
|
|
4255
|
-
let
|
|
4256
|
-
export {
|
|
4274
|
+
let code_21: "NoRefspecError";
|
|
4275
|
+
export { code_21 as code };
|
|
4257
4276
|
}
|
|
4258
4277
|
declare class NotFoundError extends BaseError {
|
|
4259
4278
|
/**
|
|
@@ -4267,8 +4286,8 @@ declare class NotFoundError extends BaseError {
|
|
|
4267
4286
|
};
|
|
4268
4287
|
}
|
|
4269
4288
|
declare namespace NotFoundError {
|
|
4270
|
-
let
|
|
4271
|
-
export {
|
|
4289
|
+
let code_22: "NotFoundError";
|
|
4290
|
+
export { code_22 as code };
|
|
4272
4291
|
}
|
|
4273
4292
|
declare class ObjectTypeError extends BaseError {
|
|
4274
4293
|
/**
|
|
@@ -4288,8 +4307,8 @@ declare class ObjectTypeError extends BaseError {
|
|
|
4288
4307
|
};
|
|
4289
4308
|
}
|
|
4290
4309
|
declare namespace ObjectTypeError {
|
|
4291
|
-
let
|
|
4292
|
-
export {
|
|
4310
|
+
let code_23: "ObjectTypeError";
|
|
4311
|
+
export { code_23 as code };
|
|
4293
4312
|
}
|
|
4294
4313
|
declare class ParseError extends BaseError {
|
|
4295
4314
|
/**
|
|
@@ -4305,8 +4324,8 @@ declare class ParseError extends BaseError {
|
|
|
4305
4324
|
};
|
|
4306
4325
|
}
|
|
4307
4326
|
declare namespace ParseError {
|
|
4308
|
-
let
|
|
4309
|
-
export {
|
|
4327
|
+
let code_24: "ParseError";
|
|
4328
|
+
export { code_24 as code };
|
|
4310
4329
|
}
|
|
4311
4330
|
declare class PushRejectedError extends BaseError {
|
|
4312
4331
|
/**
|
|
@@ -4320,8 +4339,8 @@ declare class PushRejectedError extends BaseError {
|
|
|
4320
4339
|
};
|
|
4321
4340
|
}
|
|
4322
4341
|
declare namespace PushRejectedError {
|
|
4323
|
-
let
|
|
4324
|
-
export {
|
|
4342
|
+
let code_25: "PushRejectedError";
|
|
4343
|
+
export { code_25 as code };
|
|
4325
4344
|
}
|
|
4326
4345
|
declare class RemoteCapabilityError extends BaseError {
|
|
4327
4346
|
/**
|
|
@@ -4337,8 +4356,8 @@ declare class RemoteCapabilityError extends BaseError {
|
|
|
4337
4356
|
};
|
|
4338
4357
|
}
|
|
4339
4358
|
declare namespace RemoteCapabilityError {
|
|
4340
|
-
let
|
|
4341
|
-
export {
|
|
4359
|
+
let code_26: "RemoteCapabilityError";
|
|
4360
|
+
export { code_26 as code };
|
|
4342
4361
|
}
|
|
4343
4362
|
declare class SmartHttpError extends BaseError {
|
|
4344
4363
|
/**
|
|
@@ -4354,8 +4373,8 @@ declare class SmartHttpError extends BaseError {
|
|
|
4354
4373
|
};
|
|
4355
4374
|
}
|
|
4356
4375
|
declare namespace SmartHttpError {
|
|
4357
|
-
let
|
|
4358
|
-
export {
|
|
4376
|
+
let code_27: "SmartHttpError";
|
|
4377
|
+
export { code_27 as code };
|
|
4359
4378
|
}
|
|
4360
4379
|
declare class UnknownTransportError extends BaseError {
|
|
4361
4380
|
/**
|
|
@@ -4373,8 +4392,8 @@ declare class UnknownTransportError extends BaseError {
|
|
|
4373
4392
|
};
|
|
4374
4393
|
}
|
|
4375
4394
|
declare namespace UnknownTransportError {
|
|
4376
|
-
let
|
|
4377
|
-
export {
|
|
4395
|
+
let code_28: "UnknownTransportError";
|
|
4396
|
+
export { code_28 as code };
|
|
4378
4397
|
}
|
|
4379
4398
|
declare class UnsafeFilepathError extends BaseError {
|
|
4380
4399
|
/**
|
|
@@ -4388,8 +4407,8 @@ declare class UnsafeFilepathError extends BaseError {
|
|
|
4388
4407
|
};
|
|
4389
4408
|
}
|
|
4390
4409
|
declare namespace UnsafeFilepathError {
|
|
4391
|
-
let
|
|
4392
|
-
export {
|
|
4410
|
+
let code_29: "UnsafeFilepathError";
|
|
4411
|
+
export { code_29 as code };
|
|
4393
4412
|
}
|
|
4394
4413
|
declare class UrlParseError extends BaseError {
|
|
4395
4414
|
/**
|
|
@@ -4403,8 +4422,8 @@ declare class UrlParseError extends BaseError {
|
|
|
4403
4422
|
};
|
|
4404
4423
|
}
|
|
4405
4424
|
declare namespace UrlParseError {
|
|
4406
|
-
let
|
|
4407
|
-
export {
|
|
4425
|
+
let code_30: "UrlParseError";
|
|
4426
|
+
export { code_30 as code };
|
|
4408
4427
|
}
|
|
4409
4428
|
declare class UserCanceledError extends BaseError {
|
|
4410
4429
|
constructor();
|
|
@@ -4413,8 +4432,8 @@ declare class UserCanceledError extends BaseError {
|
|
|
4413
4432
|
data: {};
|
|
4414
4433
|
}
|
|
4415
4434
|
declare namespace UserCanceledError {
|
|
4416
|
-
let
|
|
4417
|
-
export {
|
|
4435
|
+
let code_31: "UserCanceledError";
|
|
4436
|
+
export { code_31 as code };
|
|
4418
4437
|
}
|
|
4419
4438
|
declare class UnmergedPathsError extends BaseError {
|
|
4420
4439
|
/**
|
|
@@ -4428,8 +4447,8 @@ declare class UnmergedPathsError extends BaseError {
|
|
|
4428
4447
|
};
|
|
4429
4448
|
}
|
|
4430
4449
|
declare namespace UnmergedPathsError {
|
|
4431
|
-
let
|
|
4432
|
-
export {
|
|
4450
|
+
let code_32: "UnmergedPathsError";
|
|
4451
|
+
export { code_32 as code };
|
|
4433
4452
|
}
|
|
4434
4453
|
declare class IndexResetError extends BaseError {
|
|
4435
4454
|
/**
|
|
@@ -4443,8 +4462,8 @@ declare class IndexResetError extends BaseError {
|
|
|
4443
4462
|
};
|
|
4444
4463
|
}
|
|
4445
4464
|
declare namespace IndexResetError {
|
|
4446
|
-
let
|
|
4447
|
-
export {
|
|
4465
|
+
let code_33: "IndexResetError";
|
|
4466
|
+
export { code_33 as code };
|
|
4448
4467
|
}
|
|
4449
4468
|
declare class NoCommitError extends BaseError {
|
|
4450
4469
|
/**
|
|
@@ -4458,8 +4477,8 @@ declare class NoCommitError extends BaseError {
|
|
|
4458
4477
|
};
|
|
4459
4478
|
}
|
|
4460
4479
|
declare namespace NoCommitError {
|
|
4461
|
-
let
|
|
4462
|
-
export {
|
|
4480
|
+
let code_34: "NoCommitError";
|
|
4481
|
+
export { code_34 as code };
|
|
4463
4482
|
}
|
|
4464
4483
|
/**
|
|
4465
4484
|
* @typedef {Object} GitProgressEvent
|
|
@@ -4507,6 +4526,7 @@ declare namespace NoCommitError {
|
|
|
4507
4526
|
* @property {string} message Commit message
|
|
4508
4527
|
* @property {string} tree SHA-1 object id of corresponding file tree
|
|
4509
4528
|
* @property {string[]} parent an array of zero or more SHA-1 object ids
|
|
4529
|
+
* @property {Array.<Array.<string|null>>} [changes] Changed files as `[newOid, oldOid, filepath]`; present when `log` is called with `includeChanges: true`.
|
|
4510
4530
|
* @property {Object} author
|
|
4511
4531
|
* @property {string} author.name The author's name
|
|
4512
4532
|
* @property {string} author.email The author's email
|
package/index.js
CHANGED
|
@@ -59,6 +59,7 @@ import diff3Merge from 'diff3';
|
|
|
59
59
|
* @property {string} message Commit message
|
|
60
60
|
* @property {string} tree SHA-1 object id of corresponding file tree
|
|
61
61
|
* @property {string[]} parent an array of zero or more SHA-1 object ids
|
|
62
|
+
* @property {Array.<Array.<string|null>>} [changes] Changed files as `[newOid, oldOid, filepath]`; present when `log` is called with `includeChanges: true`.
|
|
62
63
|
* @property {Object} author
|
|
63
64
|
* @property {string} author.name The author's name
|
|
64
65
|
* @property {string} author.email The author's email
|
|
@@ -3732,6 +3733,16 @@ class CommitNotFetchedError extends BaseError {
|
|
|
3732
3733
|
/** @type {'CommitNotFetchedError'} */
|
|
3733
3734
|
CommitNotFetchedError.code = 'CommitNotFetchedError';
|
|
3734
3735
|
|
|
3736
|
+
class EmptyCommitError extends BaseError {
|
|
3737
|
+
constructor() {
|
|
3738
|
+
super('Cannot create an empty commit when disallowEmpty is true.');
|
|
3739
|
+
this.code = this.name = EmptyCommitError.code;
|
|
3740
|
+
this.data = {};
|
|
3741
|
+
}
|
|
3742
|
+
}
|
|
3743
|
+
/** @type {'EmptyCommitError'} */
|
|
3744
|
+
EmptyCommitError.code = 'EmptyCommitError';
|
|
3745
|
+
|
|
3735
3746
|
class EmptyServerResponseError extends BaseError {
|
|
3736
3747
|
constructor() {
|
|
3737
3748
|
super(`Empty response from git server.`);
|
|
@@ -4050,6 +4061,7 @@ var Errors = /*#__PURE__*/Object.freeze({
|
|
|
4050
4061
|
CherryPickMergeCommitError: CherryPickMergeCommitError,
|
|
4051
4062
|
CherryPickRootCommitError: CherryPickRootCommitError,
|
|
4052
4063
|
CommitNotFetchedError: CommitNotFetchedError,
|
|
4064
|
+
EmptyCommitError: EmptyCommitError,
|
|
4053
4065
|
EmptyServerResponseError: EmptyServerResponseError,
|
|
4054
4066
|
FastForwardError: FastForwardError,
|
|
4055
4067
|
GitPushError: GitPushError,
|
|
@@ -5963,6 +5975,8 @@ async function _readCommit({ fs, cache, gitdir, oid }) {
|
|
|
5963
5975
|
|
|
5964
5976
|
// @ts-check
|
|
5965
5977
|
|
|
5978
|
+
const EMPTY_TREE_OID = '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
|
|
5979
|
+
|
|
5966
5980
|
/**
|
|
5967
5981
|
*
|
|
5968
5982
|
* @param {Object} args
|
|
@@ -5985,6 +5999,7 @@ async function _readCommit({ fs, cache, gitdir, oid }) {
|
|
|
5985
5999
|
* @param {boolean} [args.amend = false]
|
|
5986
6000
|
* @param {boolean} [args.dryRun = false]
|
|
5987
6001
|
* @param {boolean} [args.noUpdateBranch = false]
|
|
6002
|
+
* @param {boolean} [args.disallowEmpty = false]
|
|
5988
6003
|
* @param {string} [args.ref]
|
|
5989
6004
|
* @param {string[]} [args.parent]
|
|
5990
6005
|
* @param {string} [args.tree]
|
|
@@ -6003,6 +6018,7 @@ async function _commit({
|
|
|
6003
6018
|
amend = false,
|
|
6004
6019
|
dryRun = false,
|
|
6005
6020
|
noUpdateBranch = false,
|
|
6021
|
+
disallowEmpty = false,
|
|
6006
6022
|
ref,
|
|
6007
6023
|
parent,
|
|
6008
6024
|
tree,
|
|
@@ -6090,6 +6106,15 @@ async function _commit({
|
|
|
6090
6106
|
);
|
|
6091
6107
|
}
|
|
6092
6108
|
|
|
6109
|
+
if (
|
|
6110
|
+
disallowEmpty &&
|
|
6111
|
+
!amend &&
|
|
6112
|
+
((initialCommit && tree === EMPTY_TREE_OID) ||
|
|
6113
|
+
(!initialCommit && tree === refCommit.commit.tree))
|
|
6114
|
+
) {
|
|
6115
|
+
throw new EmptyCommitError()
|
|
6116
|
+
}
|
|
6117
|
+
|
|
6093
6118
|
// Determine message of this commit
|
|
6094
6119
|
if (!message) {
|
|
6095
6120
|
if (!amend) {
|
|
@@ -9486,8 +9511,8 @@ function filterCapabilities(server, client) {
|
|
|
9486
9511
|
|
|
9487
9512
|
const pkg = {
|
|
9488
9513
|
name: 'isomorphic-git',
|
|
9489
|
-
version: '1.
|
|
9490
|
-
agent: 'git/isomorphic-git@1.
|
|
9514
|
+
version: '1.40.0',
|
|
9515
|
+
agent: 'git/isomorphic-git@1.40.0',
|
|
9491
9516
|
};
|
|
9492
9517
|
|
|
9493
9518
|
class FIFO {
|
|
@@ -10474,6 +10499,7 @@ async function clone({
|
|
|
10474
10499
|
* @param {boolean} [args.amend = false] - If true, replaces the last commit pointed to by `ref` with a new commit.
|
|
10475
10500
|
* @param {boolean} [args.dryRun = false] - If true, simulates making a commit so you can test whether it would succeed. Implies `noUpdateBranch`.
|
|
10476
10501
|
* @param {boolean} [args.noUpdateBranch = false] - If true, does not update the branch pointer after creating the commit.
|
|
10502
|
+
* @param {boolean} [args.disallowEmpty = false] - If true, throws an error instead of creating a commit with no staged changes.
|
|
10477
10503
|
* @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.)
|
|
10478
10504
|
* @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.
|
|
10479
10505
|
* @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.
|
|
@@ -10506,6 +10532,7 @@ async function commit({
|
|
|
10506
10532
|
amend = false,
|
|
10507
10533
|
dryRun = false,
|
|
10508
10534
|
noUpdateBranch = false,
|
|
10535
|
+
disallowEmpty = false,
|
|
10509
10536
|
ref,
|
|
10510
10537
|
parent,
|
|
10511
10538
|
tree,
|
|
@@ -10534,6 +10561,7 @@ async function commit({
|
|
|
10534
10561
|
amend,
|
|
10535
10562
|
dryRun,
|
|
10536
10563
|
noUpdateBranch,
|
|
10564
|
+
disallowEmpty,
|
|
10537
10565
|
ref,
|
|
10538
10566
|
parent,
|
|
10539
10567
|
tree,
|
|
@@ -13057,7 +13085,7 @@ async function _resolveFileId({
|
|
|
13057
13085
|
* @param {number|void} args.depth
|
|
13058
13086
|
* @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
|
|
13059
13087
|
* @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
|
|
13060
|
-
* @param {boolean=} args.
|
|
13088
|
+
* @param {boolean=} [args.includeChanges=false] Include changed file object ids for each commit.
|
|
13061
13089
|
*
|
|
13062
13090
|
* @returns {Promise<Array<ReadCommitResult>>} Resolves to an array of ReadCommitResult objects
|
|
13063
13091
|
* @see ReadCommitResult
|
|
@@ -13078,6 +13106,7 @@ async function _log({
|
|
|
13078
13106
|
since,
|
|
13079
13107
|
force,
|
|
13080
13108
|
follow,
|
|
13109
|
+
includeChanges,
|
|
13081
13110
|
}) {
|
|
13082
13111
|
const sinceTimestamp =
|
|
13083
13112
|
typeof since === 'undefined'
|
|
@@ -13205,9 +13234,57 @@ async function _log({
|
|
|
13205
13234
|
// Process tips in order by age
|
|
13206
13235
|
tips.sort((a, b) => compareAge(a.commit, b.commit));
|
|
13207
13236
|
}
|
|
13237
|
+
if (includeChanges) {
|
|
13238
|
+
for (const commit of commits) {
|
|
13239
|
+
commit.commit.changes = await getChanges({
|
|
13240
|
+
fs,
|
|
13241
|
+
cache,
|
|
13242
|
+
gitdir,
|
|
13243
|
+
commit,
|
|
13244
|
+
shallow: shallowCommits.has(commit.oid),
|
|
13245
|
+
});
|
|
13246
|
+
}
|
|
13247
|
+
}
|
|
13208
13248
|
return commits
|
|
13209
13249
|
}
|
|
13210
13250
|
|
|
13251
|
+
async function getChanges({ fs, cache, gitdir, commit, shallow }) {
|
|
13252
|
+
const parent =
|
|
13253
|
+
shallow || !commit.commit.parent[0]
|
|
13254
|
+
? '4b825dc642cb6eb9a060e54bf8d69288fbee4904'
|
|
13255
|
+
: commit.commit.parent[0];
|
|
13256
|
+
return _walk({
|
|
13257
|
+
fs,
|
|
13258
|
+
cache,
|
|
13259
|
+
gitdir,
|
|
13260
|
+
trees: [TREE({ ref: commit.oid }), TREE({ ref: parent })],
|
|
13261
|
+
map: async (filepath, [current, previous]) => {
|
|
13262
|
+
const [currentType, previousType] = await Promise.all([
|
|
13263
|
+
current && current.type(),
|
|
13264
|
+
previous && previous.type(),
|
|
13265
|
+
]);
|
|
13266
|
+
if (currentType === 'tree') {
|
|
13267
|
+
if (previousType && previousType !== 'tree') {
|
|
13268
|
+
return [null, await previous.oid(), filepath]
|
|
13269
|
+
}
|
|
13270
|
+
return
|
|
13271
|
+
}
|
|
13272
|
+
if (previousType === 'tree') {
|
|
13273
|
+
if (currentType) {
|
|
13274
|
+
return [await current.oid(), null, filepath]
|
|
13275
|
+
}
|
|
13276
|
+
return
|
|
13277
|
+
}
|
|
13278
|
+
const [newOid, oldOid] = await Promise.all([
|
|
13279
|
+
current ? current.oid() : null,
|
|
13280
|
+
previous ? previous.oid() : null,
|
|
13281
|
+
]);
|
|
13282
|
+
if (newOid === oldOid) return
|
|
13283
|
+
return [newOid, oldOid, filepath]
|
|
13284
|
+
},
|
|
13285
|
+
})
|
|
13286
|
+
}
|
|
13287
|
+
|
|
13211
13288
|
// @ts-check
|
|
13212
13289
|
|
|
13213
13290
|
/**
|
|
@@ -13223,6 +13300,7 @@ async function _log({
|
|
|
13223
13300
|
* @param {Date} [args.since] - Return history newer than the given date. Can be combined with `depth` to get whichever is shorter.
|
|
13224
13301
|
* @param {boolean=} [args.force=false] do not throw error if filepath is not exist (works only for a single file). defaults to false
|
|
13225
13302
|
* @param {boolean=} [args.follow=false] Continue listing the history of a file beyond renames (works only for a single file). defaults to false
|
|
13303
|
+
* @param {boolean=} [args.includeChanges=false] Include changed file object ids for each commit. Each tuple is `[newOid, oldOid, filepath]`; an added or removed file has a null old or new oid, respectively.
|
|
13226
13304
|
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
13227
13305
|
*
|
|
13228
13306
|
* @returns {Promise<Array<ReadCommitResult>>} Resolves to an array of ReadCommitResult objects
|
|
@@ -13249,6 +13327,7 @@ async function log({
|
|
|
13249
13327
|
since, // Date
|
|
13250
13328
|
force,
|
|
13251
13329
|
follow,
|
|
13330
|
+
includeChanges = false,
|
|
13252
13331
|
cache = {},
|
|
13253
13332
|
}) {
|
|
13254
13333
|
try {
|
|
@@ -13268,6 +13347,7 @@ async function log({
|
|
|
13268
13347
|
since,
|
|
13269
13348
|
force,
|
|
13270
13349
|
follow,
|
|
13350
|
+
includeChanges,
|
|
13271
13351
|
})
|
|
13272
13352
|
} catch (err) {
|
|
13273
13353
|
err.caller = 'git.log';
|