@osdlc/typed-git 0.7.0 → 0.7.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/CHANGELOG.md +7 -0
- package/README.md +145 -138
- package/dist/async.d.ts +22 -23
- package/dist/async.js +22 -23
- package/dist/backend.d.ts +26 -28
- package/dist/backend.js +20 -22
- package/dist/checkout-root.d.ts +33 -32
- package/dist/checkout-root.js +28 -27
- package/dist/client.d.ts +4 -4
- package/dist/client.js +5 -5
- package/dist/failure.d.ts +14 -14
- package/dist/failure.js +15 -15
- package/dist/git-url.d.ts +6 -6
- package/dist/git-url.js +6 -6
- package/dist/index.d.ts +19 -18
- package/dist/index.js +19 -18
- package/dist/outcome.d.ts +29 -27
- package/dist/outcome.js +16 -14
- package/dist/remote-url.d.ts +6 -6
- package/dist/remote-url.js +6 -6
- package/dist/soft.d.ts +5 -5
- package/dist/soft.js +5 -5
- package/dist/sync.d.ts +58 -60
- package/dist/sync.js +56 -58
- package/dist/testing.d.ts +12 -12
- package/dist/testing.js +11 -11
- package/dist/verbs.d.ts +38 -40
- package/dist/verbs.js +40 -42
- package/package.json +2 -2
package/dist/verbs.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* here once.
|
|
9
9
|
*
|
|
10
10
|
* {@link gate} is the single place a git result becomes either a value or a
|
|
11
|
-
*
|
|
11
|
+
* thrown failure. Both clients call it, so they cannot disagree.
|
|
12
12
|
*
|
|
13
13
|
* `GitVerb` and `gate` are internal: the package entries do not export them.
|
|
14
14
|
*/
|
|
@@ -51,7 +51,7 @@ export interface GitVerb<T> {
|
|
|
51
51
|
* Turn one git result into a value or a thrown failure: a `FailureError`
|
|
52
52
|
* carrying the classified `GitFailure`, whose `cause` is the `CommandFailed`.
|
|
53
53
|
*
|
|
54
|
-
* The
|
|
54
|
+
* The one place the library throws on an exit code, shared by both clients so
|
|
55
55
|
* they cannot disagree. A parse can raise its own `CommandFailed` for output
|
|
56
56
|
* it cannot read (`aheadBehind`, the integration verbs); it is handed the same
|
|
57
57
|
* argv this reports. The `CommandFailed` is the `failure.cause`; a caller
|
|
@@ -147,14 +147,13 @@ export declare function splitLines(out: string): string[];
|
|
|
147
147
|
/**
|
|
148
148
|
* A file's content at a rev (`git show <rev>:<relPath>`), null if absent.
|
|
149
149
|
*
|
|
150
|
-
* `absent: [128]` is
|
|
151
|
-
* that tree" and "not a repository"
|
|
150
|
+
* `absent: [128]` is the closest git allows. git exits 128 both for "no such
|
|
151
|
+
* path in that tree" and for "not a repository", so this verb cannot separate
|
|
152
152
|
* absence from breakage.
|
|
153
153
|
*/
|
|
154
154
|
export declare function showAtRev(rev: string, relPath: string): GitVerb<string | null>;
|
|
155
155
|
/**
|
|
156
|
-
* Trimmed `git rev-parse <args>` output
|
|
157
|
-
* query no dedicated verb covers.
|
|
156
|
+
* Trimmed `git rev-parse <args>` output, for a query no other verb covers.
|
|
158
157
|
*
|
|
159
158
|
* `absent: [1]`, the code `rev-parse --verify --quiet <ref>` returns for a ref
|
|
160
159
|
* that does not resolve. {@link resolveRef} passes those flags for you; reach
|
|
@@ -173,8 +172,8 @@ export declare function revParse(...args: string[]): GitVerb<string | null>;
|
|
|
173
172
|
*
|
|
174
173
|
* `absent: [1]` — an unborn HEAD, a branch that does not exist, a tag that was
|
|
175
174
|
* never fetched. An unreadable store exits 128 and throws, so absence stays
|
|
176
|
-
* separable from breakage. That is
|
|
177
|
-
* repository
|
|
175
|
+
* separable from breakage. That is why `resolveRef("HEAD")` is the way to check
|
|
176
|
+
* that a repository is readable. {@link objectExists} is not; see there.
|
|
178
177
|
*/
|
|
179
178
|
export declare function resolveRef(ref: string): GitVerb<string | null>;
|
|
180
179
|
/**
|
|
@@ -191,8 +190,8 @@ export declare function headRef(): GitVerb<string | null>;
|
|
|
191
190
|
/**
|
|
192
191
|
* Absolute repo top-level directory, or null outside a repo.
|
|
193
192
|
*
|
|
194
|
-
* `absent: [128]`: for this question "not a repository" is a
|
|
195
|
-
* so `if (!git.topLevel())` is the
|
|
193
|
+
* `absent: [128]`: for this question "not a repository" is a real answer,
|
|
194
|
+
* so `if (!git.topLevel())` is the usual "am I in a repo?" check. Most
|
|
196
195
|
* other verbs throw there — see {@link lsFiles}.
|
|
197
196
|
*/
|
|
198
197
|
export declare function topLevel(): GitVerb<string | null>;
|
|
@@ -324,8 +323,8 @@ export declare function configGetBool(key: string, opts?: ConfigGetOptions): Git
|
|
|
324
323
|
* A predicate, so both of git's "no" codes are absence: 1 for a well-formed
|
|
325
324
|
* name with no object behind it, 128 for a name it cannot even parse.
|
|
326
325
|
*
|
|
327
|
-
* That
|
|
328
|
-
*
|
|
326
|
+
* That is right for a predicate, and it is why this verb cannot check that a
|
|
327
|
+
* repository is readable. `false` here does not mean "no history": measured
|
|
329
328
|
* against real stores, `cat-file -e HEAD` exits 128 on an empty repository, 1
|
|
330
329
|
* on a dangling HEAD ref, and 128 again with the object directory removed — so
|
|
331
330
|
* `objectExists("HEAD")` answers `false` for all three and folds a corrupt
|
|
@@ -356,9 +355,9 @@ export declare function lsRemote(remote: string, pattern?: string | undefined, o
|
|
|
356
355
|
* exits 128 and this throws, so a caller cannot mistake "could not ask" for
|
|
357
356
|
* "nothing is ignored".
|
|
358
357
|
*
|
|
359
|
-
* A fail-closed caller
|
|
360
|
-
* published
|
|
361
|
-
* that refuses. It must neither let the
|
|
358
|
+
* A fail-closed caller, such as a check deciding whether a path may be read
|
|
359
|
+
* or published, must use `git.try.checkIgnore` with an explicit `!ok` branch
|
|
360
|
+
* that refuses. It must neither let the thrown failure escape nor read it as
|
|
362
361
|
* "not ignored":
|
|
363
362
|
*
|
|
364
363
|
* ```ts
|
|
@@ -402,11 +401,11 @@ export interface LsFilesOptions {
|
|
|
402
401
|
* Tracked and/or untracked file paths (`git ls-files -z`).
|
|
403
402
|
*
|
|
404
403
|
* `absent: []` — no matching files is exit 0 with empty stdout, so `[]` means
|
|
405
|
-
* "none". Outside a repository git exits 128 and this throws: a
|
|
404
|
+
* "none". Outside a repository git exits 128 and this throws: a check that
|
|
406
405
|
* cannot read the index has not "found zero files to check".
|
|
407
406
|
*
|
|
408
|
-
* Note the
|
|
409
|
-
*
|
|
407
|
+
* Note the difference from {@link topLevel}, which such checks often call on
|
|
408
|
+
* the line before: `topLevel()` returns null outside a repository and this verb
|
|
410
409
|
* throws there. Both are correct — "not a repository" answers "where is the
|
|
411
410
|
* root?" but not "which files are here?" — but a reader who assumes the two
|
|
412
411
|
* behave alike writes `if (!git.topLevel()) return; git.lsFiles()` and is not
|
|
@@ -717,9 +716,9 @@ export interface GrepOptions {
|
|
|
717
716
|
* real failure is 128 (not a repository, an unbalanced regex) or 129 (a usage
|
|
718
717
|
* error), and those throw.
|
|
719
718
|
*
|
|
720
|
-
*
|
|
721
|
-
*
|
|
722
|
-
*
|
|
719
|
+
* One limit: a pathspec that matches no file also exits 1, so a mistyped path
|
|
720
|
+
* reads as "no matches" rather than as an error. git gives no way to tell the
|
|
721
|
+
* two apart.
|
|
723
722
|
*
|
|
724
723
|
* Lines, not `-z`: the output is `path:line:text`, not a path listing, and `-z`
|
|
725
724
|
* only changes the separator after the path — a caller still has to split the
|
|
@@ -887,9 +886,9 @@ export type CommitOptions = CommitFlags & ({
|
|
|
887
886
|
* Commit with an inline message, a message file, or a stdin message (exactly
|
|
888
887
|
* one source).
|
|
889
888
|
*
|
|
890
|
-
* `absent: []`. A failing commit hook is a failure, not an answer
|
|
891
|
-
*
|
|
892
|
-
*
|
|
889
|
+
* `absent: []`. A failing commit hook is a failure, not an answer. Its output
|
|
890
|
+
* goes to stdout, so a caller that must report it reads `e.failure.detail`,
|
|
891
|
+
* which holds both streams, not stderr alone.
|
|
893
892
|
*/
|
|
894
893
|
export declare function commit(opts: CommitOptions): GitVerb<void>;
|
|
895
894
|
/** Options for {@link configSet}. */
|
|
@@ -983,7 +982,7 @@ export interface ForceLease {
|
|
|
983
982
|
*
|
|
984
983
|
* An empty `ref` or `expect` is refused: the empty-oid spelling means "ref
|
|
985
984
|
* must be absent", and reaching it from a missing sha by accident would turn
|
|
986
|
-
* an intended pin into the wrong
|
|
985
|
+
* an intended pin into the wrong check. Absence is only ever `expect: null`.
|
|
987
986
|
*/
|
|
988
987
|
export declare function forceWithLeaseArg(lease: ForceLease): string;
|
|
989
988
|
/**
|
|
@@ -992,8 +991,8 @@ export declare function forceWithLeaseArg(lease: ForceLease): string;
|
|
|
992
991
|
* `forceWithLease` takes a {@link ForceLease} for the pinned form, or `true`
|
|
993
992
|
* for the bare `--force-with-lease`. `true` is the unsafe form. It trusts
|
|
994
993
|
* whatever the local remote-tracking ref says, and a background fetch can
|
|
995
|
-
* bring that up to date. The lease then
|
|
996
|
-
* is
|
|
994
|
+
* bring that up to date. The lease then blocks nothing, and a concurrent push
|
|
995
|
+
* is overwritten. Pin the lease whenever the expected remote sha is known.
|
|
997
996
|
*/
|
|
998
997
|
export declare function push(remote: string, refspec: string, opts?: {
|
|
999
998
|
forceWithLease?: boolean | ForceLease | undefined;
|
|
@@ -1081,8 +1080,8 @@ export interface MergeOptions {
|
|
|
1081
1080
|
/**
|
|
1082
1081
|
* Merge `ref` into the current branch (`git merge --no-edit`).
|
|
1083
1082
|
*
|
|
1084
|
-
* `--no-edit` is
|
|
1085
|
-
*
|
|
1083
|
+
* `--no-edit` is always passed: an editor prompt in a non-interactive caller
|
|
1084
|
+
* hangs.
|
|
1086
1085
|
*
|
|
1087
1086
|
* `absent: [1]` — a conflict is this verb's "asked and answered". See the
|
|
1088
1087
|
* section note above for the measured codes and why the parse looks at
|
|
@@ -1114,9 +1113,8 @@ export declare function rebaseAbort(): GitVerb<void>;
|
|
|
1114
1113
|
/**
|
|
1115
1114
|
* `git rebase --continue`, with the editor stubbed out.
|
|
1116
1115
|
*
|
|
1117
|
-
* `-c core.editor=true` rather than an environment variable
|
|
1118
|
-
* describes
|
|
1119
|
-
* description complete.
|
|
1116
|
+
* `-c core.editor=true` rather than an environment variable, so the argv alone
|
|
1117
|
+
* describes the whole command.
|
|
1120
1118
|
*
|
|
1121
1119
|
* `absent: [1]` — the replay can conflict again on the next commit, which is
|
|
1122
1120
|
* an answer, not a failure.
|
|
@@ -1149,7 +1147,7 @@ export interface MergeTreeOptions {
|
|
|
1149
1147
|
* `git merge-tree --write-tree`: what merging `theirs` into `ours` would do,
|
|
1150
1148
|
* against the object database alone — no index, no checkout, no worktree.
|
|
1151
1149
|
*
|
|
1152
|
-
* The
|
|
1150
|
+
* The cheaper counterpart of {@link merge}. Predicting every open PR's merge across a
|
|
1153
1151
|
* 10,000-file monorepo costs seconds here; checking each one out to learn the
|
|
1154
1152
|
* same thing costs minutes, and most of them turn out to merge cleanly.
|
|
1155
1153
|
*
|
|
@@ -1161,15 +1159,15 @@ export interface MergeTreeOptions {
|
|
|
1161
1159
|
* paths in a machine-readable section rather than in translatable prose — so
|
|
1162
1160
|
* there is no need to follow up with {@link lsFilesUnmerged}.
|
|
1163
1161
|
*
|
|
1164
|
-
* `absent: [1]`, with
|
|
1165
|
-
* git 2.50.1:
|
|
1162
|
+
* `absent: [1]`, with the same stdout check as the other integration verbs.
|
|
1163
|
+
* Measured against git 2.50.1:
|
|
1166
1164
|
*
|
|
1167
1165
|
* clean 0 `<tree>`
|
|
1168
1166
|
* conflict 1 `<tree>` then the conflicted paths
|
|
1169
1167
|
* unmergeable name 1 stdout empty
|
|
1170
1168
|
* unrelated histories 128
|
|
1171
1169
|
*
|
|
1172
|
-
* A name git cannot merge exits 1 exactly like a conflict, so
|
|
1170
|
+
* A name git cannot merge exits 1 exactly like a conflict, so again only
|
|
1173
1171
|
* stdout separates an answer from a refusal.
|
|
1174
1172
|
*/
|
|
1175
1173
|
export declare function mergeTree(ours: string, theirs: string, opts?: MergeTreeOptions): GitVerb<MergeTreeOutcome>;
|
|
@@ -1204,10 +1202,10 @@ export type ConflictSide = 'ours' | 'theirs';
|
|
|
1204
1202
|
* `absent: []` — a checkout that did not happen is not an answer. Both
|
|
1205
1203
|
* clients return without running git when `paths` is empty.
|
|
1206
1204
|
*
|
|
1207
|
-
* Note
|
|
1208
|
-
*
|
|
1209
|
-
*
|
|
1210
|
-
*
|
|
1205
|
+
* Note one trap in git here: on a path that is not conflicted this exits 0 and
|
|
1206
|
+
* does nothing. There is no error to catch, so a caller working from an old
|
|
1207
|
+
* conflict list silently resolves nothing. Take the path list from
|
|
1208
|
+
* {@link lsFilesUnmerged} just before this call, not from an earlier one.
|
|
1211
1209
|
*/
|
|
1212
1210
|
export declare function checkoutSide(side: ConflictSide, paths: string[]): GitVerb<void>;
|
|
1213
1211
|
/** Options for {@link checkout}. */
|
package/dist/verbs.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* here once.
|
|
9
9
|
*
|
|
10
10
|
* {@link gate} is the single place a git result becomes either a value or a
|
|
11
|
-
*
|
|
11
|
+
* thrown failure. Both clients call it, so they cannot disagree.
|
|
12
12
|
*
|
|
13
13
|
* `GitVerb` and `gate` are internal: the package entries do not export them.
|
|
14
14
|
*/
|
|
@@ -18,7 +18,7 @@ import { gitFailureError } from "./failure.js";
|
|
|
18
18
|
* Turn one git result into a value or a thrown failure: a `FailureError`
|
|
19
19
|
* carrying the classified `GitFailure`, whose `cause` is the `CommandFailed`.
|
|
20
20
|
*
|
|
21
|
-
* The
|
|
21
|
+
* The one place the library throws on an exit code, shared by both clients so
|
|
22
22
|
* they cannot disagree. A parse can raise its own `CommandFailed` for output
|
|
23
23
|
* it cannot read (`aheadBehind`, the integration verbs); it is handed the same
|
|
24
24
|
* argv this reports. The `CommandFailed` is the `failure.cause`; a caller
|
|
@@ -48,8 +48,8 @@ export function gate(verb, result, argv) {
|
|
|
48
48
|
return verb.parse(result, argv ?? verb.argv);
|
|
49
49
|
}
|
|
50
50
|
catch (error) {
|
|
51
|
-
//
|
|
52
|
-
//
|
|
51
|
+
// Throw the classified failure, for a parse's own `CommandFailed` too.
|
|
52
|
+
// Its `cause` is the `CommandFailed`.
|
|
53
53
|
throw gitFailureError(error);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -204,8 +204,8 @@ const C_LOCALE = Object.freeze({ LC_ALL: 'C' });
|
|
|
204
204
|
/**
|
|
205
205
|
* A file's content at a rev (`git show <rev>:<relPath>`), null if absent.
|
|
206
206
|
*
|
|
207
|
-
* `absent: [128]` is
|
|
208
|
-
* that tree" and "not a repository"
|
|
207
|
+
* `absent: [128]` is the closest git allows. git exits 128 both for "no such
|
|
208
|
+
* path in that tree" and for "not a repository", so this verb cannot separate
|
|
209
209
|
* absence from breakage.
|
|
210
210
|
*/
|
|
211
211
|
export function showAtRev(rev, relPath) {
|
|
@@ -218,8 +218,7 @@ export function showAtRev(rev, relPath) {
|
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
|
-
* Trimmed `git rev-parse <args>` output
|
|
222
|
-
* query no dedicated verb covers.
|
|
221
|
+
* Trimmed `git rev-parse <args>` output, for a query no other verb covers.
|
|
223
222
|
*
|
|
224
223
|
* `absent: [1]`, the code `rev-parse --verify --quiet <ref>` returns for a ref
|
|
225
224
|
* that does not resolve. {@link resolveRef} passes those flags for you; reach
|
|
@@ -240,8 +239,8 @@ export function revParse(...args) {
|
|
|
240
239
|
*
|
|
241
240
|
* `absent: [1]` — an unborn HEAD, a branch that does not exist, a tag that was
|
|
242
241
|
* never fetched. An unreadable store exits 128 and throws, so absence stays
|
|
243
|
-
* separable from breakage. That is
|
|
244
|
-
* repository
|
|
242
|
+
* separable from breakage. That is why `resolveRef("HEAD")` is the way to check
|
|
243
|
+
* that a repository is readable. {@link objectExists} is not; see there.
|
|
245
244
|
*/
|
|
246
245
|
export function resolveRef(ref) {
|
|
247
246
|
return {
|
|
@@ -270,8 +269,8 @@ export function headRef() {
|
|
|
270
269
|
/**
|
|
271
270
|
* Absolute repo top-level directory, or null outside a repo.
|
|
272
271
|
*
|
|
273
|
-
* `absent: [128]`: for this question "not a repository" is a
|
|
274
|
-
* so `if (!git.topLevel())` is the
|
|
272
|
+
* `absent: [128]`: for this question "not a repository" is a real answer,
|
|
273
|
+
* so `if (!git.topLevel())` is the usual "am I in a repo?" check. Most
|
|
275
274
|
* other verbs throw there — see {@link lsFiles}.
|
|
276
275
|
*/
|
|
277
276
|
export function topLevel() {
|
|
@@ -533,8 +532,8 @@ export function configGetBool(key, opts = {}) {
|
|
|
533
532
|
* A predicate, so both of git's "no" codes are absence: 1 for a well-formed
|
|
534
533
|
* name with no object behind it, 128 for a name it cannot even parse.
|
|
535
534
|
*
|
|
536
|
-
* That
|
|
537
|
-
*
|
|
535
|
+
* That is right for a predicate, and it is why this verb cannot check that a
|
|
536
|
+
* repository is readable. `false` here does not mean "no history": measured
|
|
538
537
|
* against real stores, `cat-file -e HEAD` exits 128 on an empty repository, 1
|
|
539
538
|
* on a dangling HEAD ref, and 128 again with the object directory removed — so
|
|
540
539
|
* `objectExists("HEAD")` answers `false` for all three and folds a corrupt
|
|
@@ -579,9 +578,9 @@ export function lsRemote(remote, pattern, opts = {}) {
|
|
|
579
578
|
* exits 128 and this throws, so a caller cannot mistake "could not ask" for
|
|
580
579
|
* "nothing is ignored".
|
|
581
580
|
*
|
|
582
|
-
* A fail-closed caller
|
|
583
|
-
* published
|
|
584
|
-
* that refuses. It must neither let the
|
|
581
|
+
* A fail-closed caller, such as a check deciding whether a path may be read
|
|
582
|
+
* or published, must use `git.try.checkIgnore` with an explicit `!ok` branch
|
|
583
|
+
* that refuses. It must neither let the thrown failure escape nor read it as
|
|
585
584
|
* "not ignored":
|
|
586
585
|
*
|
|
587
586
|
* ```ts
|
|
@@ -623,11 +622,11 @@ export function checkIgnoreVerbose(relPaths) {
|
|
|
623
622
|
* Tracked and/or untracked file paths (`git ls-files -z`).
|
|
624
623
|
*
|
|
625
624
|
* `absent: []` — no matching files is exit 0 with empty stdout, so `[]` means
|
|
626
|
-
* "none". Outside a repository git exits 128 and this throws: a
|
|
625
|
+
* "none". Outside a repository git exits 128 and this throws: a check that
|
|
627
626
|
* cannot read the index has not "found zero files to check".
|
|
628
627
|
*
|
|
629
|
-
* Note the
|
|
630
|
-
*
|
|
628
|
+
* Note the difference from {@link topLevel}, which such checks often call on
|
|
629
|
+
* the line before: `topLevel()` returns null outside a repository and this verb
|
|
631
630
|
* throws there. Both are correct — "not a repository" answers "where is the
|
|
632
631
|
* root?" but not "which files are here?" — but a reader who assumes the two
|
|
633
632
|
* behave alike writes `if (!git.topLevel()) return; git.lsFiles()` and is not
|
|
@@ -991,9 +990,9 @@ export function diffTreeNumstat(rev, opts = {}) {
|
|
|
991
990
|
* real failure is 128 (not a repository, an unbalanced regex) or 129 (a usage
|
|
992
991
|
* error), and those throw.
|
|
993
992
|
*
|
|
994
|
-
*
|
|
995
|
-
*
|
|
996
|
-
*
|
|
993
|
+
* One limit: a pathspec that matches no file also exits 1, so a mistyped path
|
|
994
|
+
* reads as "no matches" rather than as an error. git gives no way to tell the
|
|
995
|
+
* two apart.
|
|
997
996
|
*
|
|
998
997
|
* Lines, not `-z`: the output is `path:line:text`, not a path listing, and `-z`
|
|
999
998
|
* only changes the separator after the path — a caller still has to split the
|
|
@@ -1176,9 +1175,9 @@ export function add(paths, opts = {}) {
|
|
|
1176
1175
|
* Commit with an inline message, a message file, or a stdin message (exactly
|
|
1177
1176
|
* one source).
|
|
1178
1177
|
*
|
|
1179
|
-
* `absent: []`. A failing commit hook is a failure, not an answer
|
|
1180
|
-
*
|
|
1181
|
-
*
|
|
1178
|
+
* `absent: []`. A failing commit hook is a failure, not an answer. Its output
|
|
1179
|
+
* goes to stdout, so a caller that must report it reads `e.failure.detail`,
|
|
1180
|
+
* which holds both streams, not stderr alone.
|
|
1182
1181
|
*/
|
|
1183
1182
|
export function commit(opts) {
|
|
1184
1183
|
const argv = ['commit'];
|
|
@@ -1278,7 +1277,7 @@ export function clone(url, dest, opts = {}) {
|
|
|
1278
1277
|
*
|
|
1279
1278
|
* An empty `ref` or `expect` is refused: the empty-oid spelling means "ref
|
|
1280
1279
|
* must be absent", and reaching it from a missing sha by accident would turn
|
|
1281
|
-
* an intended pin into the wrong
|
|
1280
|
+
* an intended pin into the wrong check. Absence is only ever `expect: null`.
|
|
1282
1281
|
*/
|
|
1283
1282
|
export function forceWithLeaseArg(lease) {
|
|
1284
1283
|
if (lease.ref === '')
|
|
@@ -1294,8 +1293,8 @@ export function forceWithLeaseArg(lease) {
|
|
|
1294
1293
|
* `forceWithLease` takes a {@link ForceLease} for the pinned form, or `true`
|
|
1295
1294
|
* for the bare `--force-with-lease`. `true` is the unsafe form. It trusts
|
|
1296
1295
|
* whatever the local remote-tracking ref says, and a background fetch can
|
|
1297
|
-
* bring that up to date. The lease then
|
|
1298
|
-
* is
|
|
1296
|
+
* bring that up to date. The lease then blocks nothing, and a concurrent push
|
|
1297
|
+
* is overwritten. Pin the lease whenever the expected remote sha is known.
|
|
1299
1298
|
*/
|
|
1300
1299
|
export function push(remote, refspec, opts = {}) {
|
|
1301
1300
|
const argv = ['push'];
|
|
@@ -1427,8 +1426,8 @@ function conflictOrThrow(argv, r) {
|
|
|
1427
1426
|
/**
|
|
1428
1427
|
* Merge `ref` into the current branch (`git merge --no-edit`).
|
|
1429
1428
|
*
|
|
1430
|
-
* `--no-edit` is
|
|
1431
|
-
*
|
|
1429
|
+
* `--no-edit` is always passed: an editor prompt in a non-interactive caller
|
|
1430
|
+
* hangs.
|
|
1432
1431
|
*
|
|
1433
1432
|
* `absent: [1]` — a conflict is this verb's "asked and answered". See the
|
|
1434
1433
|
* section note above for the measured codes and why the parse looks at
|
|
@@ -1504,9 +1503,8 @@ export function rebaseAbort() {
|
|
|
1504
1503
|
/**
|
|
1505
1504
|
* `git rebase --continue`, with the editor stubbed out.
|
|
1506
1505
|
*
|
|
1507
|
-
* `-c core.editor=true` rather than an environment variable
|
|
1508
|
-
* describes
|
|
1509
|
-
* description complete.
|
|
1506
|
+
* `-c core.editor=true` rather than an environment variable, so the argv alone
|
|
1507
|
+
* describes the whole command.
|
|
1510
1508
|
*
|
|
1511
1509
|
* `absent: [1]` — the replay can conflict again on the next commit, which is
|
|
1512
1510
|
* an answer, not a failure.
|
|
@@ -1528,7 +1526,7 @@ export function rebaseContinue() {
|
|
|
1528
1526
|
* `git merge-tree --write-tree`: what merging `theirs` into `ours` would do,
|
|
1529
1527
|
* against the object database alone — no index, no checkout, no worktree.
|
|
1530
1528
|
*
|
|
1531
|
-
* The
|
|
1529
|
+
* The cheaper counterpart of {@link merge}. Predicting every open PR's merge across a
|
|
1532
1530
|
* 10,000-file monorepo costs seconds here; checking each one out to learn the
|
|
1533
1531
|
* same thing costs minutes, and most of them turn out to merge cleanly.
|
|
1534
1532
|
*
|
|
@@ -1540,15 +1538,15 @@ export function rebaseContinue() {
|
|
|
1540
1538
|
* paths in a machine-readable section rather than in translatable prose — so
|
|
1541
1539
|
* there is no need to follow up with {@link lsFilesUnmerged}.
|
|
1542
1540
|
*
|
|
1543
|
-
* `absent: [1]`, with
|
|
1544
|
-
* git 2.50.1:
|
|
1541
|
+
* `absent: [1]`, with the same stdout check as the other integration verbs.
|
|
1542
|
+
* Measured against git 2.50.1:
|
|
1545
1543
|
*
|
|
1546
1544
|
* clean 0 `<tree>`
|
|
1547
1545
|
* conflict 1 `<tree>` then the conflicted paths
|
|
1548
1546
|
* unmergeable name 1 stdout empty
|
|
1549
1547
|
* unrelated histories 128
|
|
1550
1548
|
*
|
|
1551
|
-
* A name git cannot merge exits 1 exactly like a conflict, so
|
|
1549
|
+
* A name git cannot merge exits 1 exactly like a conflict, so again only
|
|
1552
1550
|
* stdout separates an answer from a refusal.
|
|
1553
1551
|
*/
|
|
1554
1552
|
export function mergeTree(ours, theirs, opts = {}) {
|
|
@@ -1621,10 +1619,10 @@ export function lsFilesUnmerged() {
|
|
|
1621
1619
|
* `absent: []` — a checkout that did not happen is not an answer. Both
|
|
1622
1620
|
* clients return without running git when `paths` is empty.
|
|
1623
1621
|
*
|
|
1624
|
-
* Note
|
|
1625
|
-
*
|
|
1626
|
-
*
|
|
1627
|
-
*
|
|
1622
|
+
* Note one trap in git here: on a path that is not conflicted this exits 0 and
|
|
1623
|
+
* does nothing. There is no error to catch, so a caller working from an old
|
|
1624
|
+
* conflict list silently resolves nothing. Take the path list from
|
|
1625
|
+
* {@link lsFilesUnmerged} just before this call, not from an earlier one.
|
|
1628
1626
|
*/
|
|
1629
1627
|
export function checkoutSide(side, paths) {
|
|
1630
1628
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdlc/typed-git",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "A typed git client for TypeScript, sync and awaitable. Each verb declares what absence means for it; every other failure throws. git.try.* inspects, raw() bypasses — over an injectable backend that drives the git CLI or any other implementation.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"author": "sksizer",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
],
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"hosted-git-info": "^10.1.1",
|
|
55
|
-
"@osdlc/command-seam": "^0.
|
|
55
|
+
"@osdlc/command-seam": "^0.10.0",
|
|
56
56
|
"@osdlc/result": "^0.1.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|