@procedures/git 0.2.3 → 0.4.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/CHANGELOG.md +82 -0
- package/README.md +125 -17
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +314 -4
- package/dist/module.js.map +1 -1
- package/dist/procedures/git/blame.d.ts +17 -0
- package/dist/procedures/git/blame.d.ts.map +1 -0
- package/dist/procedures/git/blame.js +69 -0
- package/dist/procedures/git/blame.js.map +1 -0
- package/dist/procedures/git/branch/add.d.ts +12 -0
- package/dist/procedures/git/branch/add.d.ts.map +1 -0
- package/dist/procedures/git/branch/add.js +21 -0
- package/dist/procedures/git/branch/add.js.map +1 -0
- package/dist/procedures/git/branch/delete.d.ts +13 -0
- package/dist/procedures/git/branch/delete.d.ts.map +1 -0
- package/dist/procedures/git/branch/delete.js +24 -0
- package/dist/procedures/git/branch/delete.js.map +1 -0
- package/dist/procedures/git/branch/list.d.ts +13 -0
- package/dist/procedures/git/branch/list.d.ts.map +1 -0
- package/dist/procedures/git/branch/list.js +37 -0
- package/dist/procedures/git/branch/list.js.map +1 -0
- package/dist/procedures/git/branch.d.ts +8 -2
- package/dist/procedures/git/branch.d.ts.map +1 -1
- package/dist/procedures/git/branch.js +18 -37
- package/dist/procedures/git/branch.js.map +1 -1
- package/dist/procedures/git/commit.d.ts +2 -1
- package/dist/procedures/git/commit.d.ts.map +1 -1
- package/dist/procedures/git/commit.js +21 -12
- package/dist/procedures/git/commit.js.map +1 -1
- package/dist/procedures/git/index.d.ts +19 -0
- package/dist/procedures/git/index.d.ts.map +1 -1
- package/dist/procedures/git/index.js +19 -0
- package/dist/procedures/git/index.js.map +1 -1
- package/dist/procedures/git/init.d.ts +6 -2
- package/dist/procedures/git/init.d.ts.map +1 -1
- package/dist/procedures/git/init.js +8 -4
- package/dist/procedures/git/init.js.map +1 -1
- package/dist/procedures/git/merge/abort.d.ts +14 -0
- package/dist/procedures/git/merge/abort.d.ts.map +1 -0
- package/dist/procedures/git/merge/abort.js +18 -0
- package/dist/procedures/git/merge/abort.js.map +1 -0
- package/dist/procedures/git/merge.d.ts +16 -0
- package/dist/procedures/git/merge.d.ts.map +1 -0
- package/dist/procedures/git/merge.js +41 -0
- package/dist/procedures/git/merge.js.map +1 -0
- package/dist/procedures/git/porcelain.d.ts +27 -0
- package/dist/procedures/git/porcelain.d.ts.map +1 -0
- package/dist/procedures/git/porcelain.js +66 -0
- package/dist/procedures/git/porcelain.js.map +1 -0
- package/dist/procedures/git/push.d.ts.map +1 -1
- package/dist/procedures/git/push.js +4 -2
- package/dist/procedures/git/push.js.map +1 -1
- package/dist/procedures/git/rebase/abort.d.ts +13 -0
- package/dist/procedures/git/rebase/abort.d.ts.map +1 -0
- package/dist/procedures/git/rebase/abort.js +17 -0
- package/dist/procedures/git/rebase/abort.js.map +1 -0
- package/dist/procedures/git/rebase/continue.d.ts +13 -0
- package/dist/procedures/git/rebase/continue.d.ts.map +1 -0
- package/dist/procedures/git/rebase/continue.js +23 -0
- package/dist/procedures/git/rebase/continue.js.map +1 -0
- package/dist/procedures/git/rebase.d.ts +22 -0
- package/dist/procedures/git/rebase.d.ts.map +1 -0
- package/dist/procedures/git/rebase.js +46 -0
- package/dist/procedures/git/rebase.js.map +1 -0
- package/dist/procedures/git/refs.d.ts +31 -0
- package/dist/procedures/git/refs.d.ts.map +1 -0
- package/dist/procedures/git/refs.js +52 -0
- package/dist/procedures/git/refs.js.map +1 -0
- package/dist/procedures/git/reset.d.ts +13 -0
- package/dist/procedures/git/reset.d.ts.map +1 -0
- package/dist/procedures/git/reset.js +31 -0
- package/dist/procedures/git/reset.js.map +1 -0
- package/dist/procedures/git/restore.d.ts +13 -0
- package/dist/procedures/git/restore.d.ts.map +1 -0
- package/dist/procedures/git/restore.js +26 -0
- package/dist/procedures/git/restore.js.map +1 -0
- package/dist/procedures/git/revParse.d.ts +13 -0
- package/dist/procedures/git/revParse.d.ts.map +1 -0
- package/dist/procedures/git/revParse.js +23 -0
- package/dist/procedures/git/revParse.js.map +1 -0
- package/dist/procedures/git/run.d.ts +2 -0
- package/dist/procedures/git/run.d.ts.map +1 -1
- package/dist/procedures/git/run.js +1 -0
- package/dist/procedures/git/run.js.map +1 -1
- package/dist/procedures/git/show.d.ts +15 -0
- package/dist/procedures/git/show.d.ts.map +1 -0
- package/dist/procedures/git/show.js +49 -0
- package/dist/procedures/git/show.js.map +1 -0
- package/dist/procedures/git/status.d.ts +3 -1
- package/dist/procedures/git/status.d.ts.map +1 -1
- package/dist/procedures/git/status.js +11 -24
- package/dist/procedures/git/status.js.map +1 -1
- package/dist/procedures/git/tag/add.d.ts +12 -0
- package/dist/procedures/git/tag/add.d.ts.map +1 -0
- package/dist/procedures/git/tag/add.js +25 -0
- package/dist/procedures/git/tag/add.js.map +1 -0
- package/dist/procedures/git/tag/delete.d.ts +12 -0
- package/dist/procedures/git/tag/delete.d.ts.map +1 -0
- package/dist/procedures/git/tag/delete.js +19 -0
- package/dist/procedures/git/tag/delete.js.map +1 -0
- package/dist/procedures/git/tag/list.d.ts +12 -0
- package/dist/procedures/git/tag/list.d.ts.map +1 -0
- package/dist/procedures/git/tag/list.js +34 -0
- package/dist/procedures/git/tag/list.js.map +1 -0
- package/dist/procedures/git/worktree/add.d.ts +13 -0
- package/dist/procedures/git/worktree/add.d.ts.map +1 -0
- package/dist/procedures/git/worktree/add.js +35 -0
- package/dist/procedures/git/worktree/add.js.map +1 -0
- package/dist/procedures/git/worktree/list.d.ts +17 -0
- package/dist/procedures/git/worktree/list.d.ts.map +1 -0
- package/dist/procedures/git/worktree/list.js +52 -0
- package/dist/procedures/git/worktree/list.js.map +1 -0
- package/dist/procedures/git/worktree/remove.d.ts +13 -0
- package/dist/procedures/git/worktree/remove.d.ts.map +1 -0
- package/dist/procedures/git/worktree/remove.js +20 -0
- package/dist/procedures/git/worktree/remove.js.map +1 -0
- package/dist/types.d.ts +315 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +280 -0
- package/dist/types.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +2 -1
- package/src/module.ts +413 -4
- package/src/procedures/git/blame.ts +68 -0
- package/src/procedures/git/branch/add.ts +24 -0
- package/src/procedures/git/branch/delete.ts +29 -0
- package/src/procedures/git/branch/list.ts +40 -0
- package/src/procedures/git/branch.ts +19 -40
- package/src/procedures/git/commit.ts +20 -12
- package/src/procedures/git/index.ts +19 -0
- package/src/procedures/git/init.ts +11 -10
- package/src/procedures/git/merge/abort.ts +20 -0
- package/src/procedures/git/merge.ts +42 -0
- package/src/procedures/git/porcelain.ts +63 -0
- package/src/procedures/git/push.ts +4 -2
- package/src/procedures/git/rebase/abort.ts +19 -0
- package/src/procedures/git/rebase/continue.ts +25 -0
- package/src/procedures/git/rebase.ts +48 -0
- package/src/procedures/git/refs.ts +55 -0
- package/src/procedures/git/reset.ts +34 -0
- package/src/procedures/git/restore.ts +27 -0
- package/src/procedures/git/revParse.ts +24 -0
- package/src/procedures/git/run.ts +3 -0
- package/src/procedures/git/show.ts +57 -0
- package/src/procedures/git/status.ts +9 -17
- package/src/procedures/git/tag/add.ts +27 -0
- package/src/procedures/git/tag/delete.ts +22 -0
- package/src/procedures/git/tag/list.ts +36 -0
- package/src/procedures/git/worktree/add.ts +35 -0
- package/src/procedures/git/worktree/list.ts +48 -0
- package/src/procedures/git/worktree/remove.ts +21 -0
- package/src/types.ts +641 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.show procedure
|
|
3
|
+
*
|
|
4
|
+
* Show a commit, or a file at a commit (roadmap R40).
|
|
5
|
+
*
|
|
6
|
+
* The procedure first resolves the ref to its commit, so a tag gives its commit and not the text
|
|
7
|
+
* of the tag object. A merge commit gives its changes against its first parent.
|
|
8
|
+
*/
|
|
9
|
+
import { parseNumstat } from "./diff.js";
|
|
10
|
+
import { git } from "./run.js";
|
|
11
|
+
import { commitOf } from "./refs.js";
|
|
12
|
+
// Control characters that do not occur in a name, an email, a date or a subject
|
|
13
|
+
const FIELD = "\x1f";
|
|
14
|
+
/**
|
|
15
|
+
* Show a commit, or a file at a commit
|
|
16
|
+
*/
|
|
17
|
+
export async function gitShow(input, ctx = {}) {
|
|
18
|
+
const ref = input.ref ?? "HEAD";
|
|
19
|
+
const run = { cwd: input.cwd, signal: ctx.signal };
|
|
20
|
+
const hash = await commitOf(ref, run);
|
|
21
|
+
// A file at the commit: `<hash>:<path>` starts with the hash, so a path that starts with "-"
|
|
22
|
+
// stays a path
|
|
23
|
+
if (input.path !== undefined) {
|
|
24
|
+
const content = await git(["show", `${hash}:${input.path}`], run);
|
|
25
|
+
return { ref, hash, path: input.path, content };
|
|
26
|
+
}
|
|
27
|
+
const format = `--format=${["%H", "%h", "%an", "%ae", "%ci", "%s", "%b"].join("%x1f")}`;
|
|
28
|
+
const [, shortHash = "", author = "", email = "", date = "", message = "", body = ""] = (await git(["show", "-s", format, hash], run)).split(FIELD);
|
|
29
|
+
const changes = ["show", "--format=", "--diff-merges=first-parent"];
|
|
30
|
+
const files = parseNumstat(await git([...changes, "--numstat", "-z", hash], run));
|
|
31
|
+
const result = {
|
|
32
|
+
ref,
|
|
33
|
+
hash,
|
|
34
|
+
shortHash,
|
|
35
|
+
author,
|
|
36
|
+
email,
|
|
37
|
+
date,
|
|
38
|
+
message,
|
|
39
|
+
body: body.replace(/\n+$/, ""),
|
|
40
|
+
files,
|
|
41
|
+
additions: files.reduce((sum, file) => sum + file.additions, 0),
|
|
42
|
+
deletions: files.reduce((sum, file) => sum + file.deletions, 0),
|
|
43
|
+
};
|
|
44
|
+
if (!input.stat) {
|
|
45
|
+
result.diff = (await git([...changes, "--patch", hash], run)).replace(/^\n/, "");
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMapping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
|
|
12
12
|
import type { GitStatusInput, GitStatusOutput } from "../../types.js";
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* This function gives the git status. With `paths`, it gives only the files of those pathspecs.
|
|
15
|
+
* With `untrackedFiles`, git lists the untracked files in that mode: "all" lists each file of a
|
|
16
|
+
* new folder.
|
|
15
17
|
*/
|
|
16
18
|
export declare function gitStatus(input: GitStatusInput, ctx?: GitContext): Promise<GitStatusOutput>;
|
|
17
19
|
//# sourceMappingURL=status.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/procedures/git/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/procedures/git/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAiB,MAAM,gBAAgB,CAAC;AASrF;;;;GAIG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CA8DrG"}
|
|
@@ -9,28 +9,7 @@
|
|
|
9
9
|
* so a path with a space kept its quotes, and a rename gave the text "old -> new" as the path.
|
|
10
10
|
*/
|
|
11
11
|
import { git, zFields } from "./run.js";
|
|
12
|
-
|
|
13
|
-
function classify(xy) {
|
|
14
|
-
const index = xy[0];
|
|
15
|
-
const worktree = xy[1];
|
|
16
|
-
if (index === "A")
|
|
17
|
-
return { status: "added", staged: true };
|
|
18
|
-
if (index === "D")
|
|
19
|
-
return { status: "deleted", staged: true };
|
|
20
|
-
if (index === "R")
|
|
21
|
-
return { status: "renamed", staged: true };
|
|
22
|
-
if (index === "C")
|
|
23
|
-
return { status: "copied", staged: true };
|
|
24
|
-
if (index === "M" || index === "T")
|
|
25
|
-
return { status: "modified", staged: true };
|
|
26
|
-
if (worktree === "D")
|
|
27
|
-
return { status: "deleted", staged: false };
|
|
28
|
-
if (worktree === "A")
|
|
29
|
-
return { status: "added", staged: false };
|
|
30
|
-
if (worktree === "R")
|
|
31
|
-
return { status: "renamed", staged: false };
|
|
32
|
-
return { status: "modified", staged: false };
|
|
33
|
-
}
|
|
12
|
+
import { classifyStatus as classify } from "./porcelain.js";
|
|
34
13
|
/** The text after the first `count` space-separated fields of a line. */
|
|
35
14
|
function afterFields(line, count) {
|
|
36
15
|
let at = 0;
|
|
@@ -39,10 +18,18 @@ function afterFields(line, count) {
|
|
|
39
18
|
return line.slice(at);
|
|
40
19
|
}
|
|
41
20
|
/**
|
|
42
|
-
*
|
|
21
|
+
* This function gives the git status. With `paths`, it gives only the files of those pathspecs.
|
|
22
|
+
* With `untrackedFiles`, git lists the untracked files in that mode: "all" lists each file of a
|
|
23
|
+
* new folder.
|
|
43
24
|
*/
|
|
44
25
|
export async function gitStatus(input, ctx = {}) {
|
|
45
|
-
const
|
|
26
|
+
const args = ["status", "--porcelain=v2", "--branch", "-z"];
|
|
27
|
+
if (input.untrackedFiles !== undefined)
|
|
28
|
+
args.push(`--untracked-files=${input.untrackedFiles}`);
|
|
29
|
+
// After "--", git reads each value as a pathspec, also a value that starts with "-"
|
|
30
|
+
if (input.paths !== undefined && input.paths.length > 0)
|
|
31
|
+
args.push("--", ...input.paths);
|
|
32
|
+
const output = await git(args, { cwd: input.cwd, signal: ctx.signal });
|
|
46
33
|
let branch = "HEAD";
|
|
47
34
|
let ahead = 0;
|
|
48
35
|
let behind = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/procedures/git/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,GAAG,EAAE,OAAO,EAAmB,M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C,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;YACzD,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;QAC3B,CAAC;aAAM,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;YACvD,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAoB;QAC9B,MAAM;QACN,KAAK;QACL,MAAM;QACN,KAAK;QACL,KAAK,EAAE,KAAK,CAAC,MAAM,KAAK,CAAC;KAC1B,CAAC;IACF,IAAI,KAAK,CAAC,KAAK;QAAE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;IACtC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.tag.add procedure
|
|
3
|
+
*
|
|
4
|
+
* Make a tag (roadmap R40). An existing tag is an error: the procedure never moves a tag.
|
|
5
|
+
*/
|
|
6
|
+
import { type GitContext } from "../run.js";
|
|
7
|
+
import type { GitTagAddInput, GitTagAddOutput } from "../../../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Make a tag
|
|
10
|
+
*/
|
|
11
|
+
export declare function gitTagAdd(input: GitTagAddInput, ctx?: GitContext): Promise<GitTagAddOutput>;
|
|
12
|
+
//# sourceMappingURL=add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../src/procedures/git/tag/add.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzE;;GAEG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAYrG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.tag.add procedure
|
|
3
|
+
*
|
|
4
|
+
* Make a tag (roadmap R40). An existing tag is an error: the procedure never moves a tag.
|
|
5
|
+
*/
|
|
6
|
+
import { gitArg } from "../args.js";
|
|
7
|
+
import { git } from "../run.js";
|
|
8
|
+
import { commitOf } from "../refs.js";
|
|
9
|
+
/**
|
|
10
|
+
* Make a tag
|
|
11
|
+
*/
|
|
12
|
+
export async function gitTagAdd(input, ctx = {}) {
|
|
13
|
+
const { name, ref, message, cwd } = input;
|
|
14
|
+
const run = { cwd, signal: ctx.signal };
|
|
15
|
+
const args = ["tag"];
|
|
16
|
+
// With -m, git makes an annotated tag and does not start an editor
|
|
17
|
+
if (message !== undefined)
|
|
18
|
+
args.push("-a", "-m", message);
|
|
19
|
+
args.push(gitArg("name", name));
|
|
20
|
+
if (ref)
|
|
21
|
+
args.push(gitArg("ref", ref));
|
|
22
|
+
await git(args, run);
|
|
23
|
+
return { name, hash: await commitOf(`refs/tags/${name}`, run), annotated: message !== undefined };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../src/procedures/git/tag/add.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAmB,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAqB,EAAE,GAAG,GAAe,EAAE;IACzE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IAC1C,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IAExC,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IACrB,mEAAmE;IACnE,IAAI,OAAO,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1D,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAChC,IAAI,GAAG;QAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IACvC,MAAM,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAErB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC,aAAa,IAAI,EAAE,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,KAAK,SAAS,EAAE,CAAC;AACpG,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.tag.delete procedure
|
|
3
|
+
*
|
|
4
|
+
* Delete a tag (roadmap R40).
|
|
5
|
+
*/
|
|
6
|
+
import { type GitContext } from "../run.js";
|
|
7
|
+
import type { GitTagDeleteInput, GitTagDeleteOutput } from "../../../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Delete a tag
|
|
10
|
+
*/
|
|
11
|
+
export declare function gitTagDelete(input: GitTagDeleteInput, ctx?: GitContext): Promise<GitTagDeleteOutput>;
|
|
12
|
+
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../../src/procedures/git/tag/delete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE/E;;GAEG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAQ9G"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.tag.delete procedure
|
|
3
|
+
*
|
|
4
|
+
* Delete a tag (roadmap R40).
|
|
5
|
+
*/
|
|
6
|
+
import { gitArg } from "../args.js";
|
|
7
|
+
import { git } from "../run.js";
|
|
8
|
+
/**
|
|
9
|
+
* Delete a tag
|
|
10
|
+
*/
|
|
11
|
+
export async function gitTagDelete(input, ctx = {}) {
|
|
12
|
+
const name = gitArg("name", input.name);
|
|
13
|
+
const run = { cwd: input.cwd, signal: ctx.signal };
|
|
14
|
+
// The object of the tag before the deletion: a tag object or a commit
|
|
15
|
+
const hash = (await git(["rev-parse", "--verify", `refs/tags/${name}`], run)).trim();
|
|
16
|
+
await git(["tag", "-d", name], run);
|
|
17
|
+
return { name, hash };
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/procedures/git/tag/delete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAmB,MAAM,WAAW,CAAC;AAGjD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,KAAwB,EAAE,GAAG,GAAe,EAAE;IAC/E,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IAEnD,sEAAsE;IACtE,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,aAAa,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACrF,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IACpC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.tag.list procedure
|
|
3
|
+
*
|
|
4
|
+
* List the tags (roadmap R40).
|
|
5
|
+
*/
|
|
6
|
+
import { type GitContext } from "../run.js";
|
|
7
|
+
import type { GitTagListInput, GitTagListOutput } from "../../../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* List the tags
|
|
10
|
+
*/
|
|
11
|
+
export declare function gitTagList(input: GitTagListInput, ctx?: GitContext): Promise<GitTagListOutput>;
|
|
12
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/procedures/git/tag/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAc,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAQvF;;GAEG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAgBxG"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.tag.list procedure
|
|
3
|
+
*
|
|
4
|
+
* List the tags (roadmap R40).
|
|
5
|
+
*/
|
|
6
|
+
import { gitArg } from "../args.js";
|
|
7
|
+
import { git } from "../run.js";
|
|
8
|
+
/**
|
|
9
|
+
* The fields of each tag, separated by NUL: the name, the type of the object, the commit of an
|
|
10
|
+
* annotated tag, the object, and the subject of the message.
|
|
11
|
+
*/
|
|
12
|
+
const FORMAT = "--format=%(refname:strip=2)%00%(objecttype)%00%(*objectname)%00%(objectname)%00%(contents:subject)";
|
|
13
|
+
/**
|
|
14
|
+
* List the tags
|
|
15
|
+
*/
|
|
16
|
+
export async function gitTagList(input, ctx = {}) {
|
|
17
|
+
const args = ["tag", "--list", FORMAT];
|
|
18
|
+
if (input.pattern)
|
|
19
|
+
args.push(gitArg("pattern", input.pattern));
|
|
20
|
+
const output = await git(args, { cwd: input.cwd, signal: ctx.signal });
|
|
21
|
+
const tags = output
|
|
22
|
+
.split("\n")
|
|
23
|
+
.filter((line) => line.length > 0)
|
|
24
|
+
.map((line) => {
|
|
25
|
+
const [name = "", type = "", peeled = "", object = "", subject = ""] = line.split("\0");
|
|
26
|
+
const annotated = type === "tag";
|
|
27
|
+
const tag = { name, hash: annotated && peeled ? peeled : object, annotated };
|
|
28
|
+
if (annotated)
|
|
29
|
+
tag.message = subject;
|
|
30
|
+
return tag;
|
|
31
|
+
});
|
|
32
|
+
return { tags };
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/procedures/git/tag/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAmB,MAAM,WAAW,CAAC;AAGjD;;;GAGG;AACH,MAAM,MAAM,GAAG,oGAAoG,CAAC;AAE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|
4
|
+
* Add a working tree (roadmap R40). Git refuses a folder that exists and is not empty. Without
|
|
5
|
+
* `ref`, `branch` and `detach`, git makes a branch with the name of the folder.
|
|
6
|
+
*/
|
|
7
|
+
import { type GitContext } from "../run.js";
|
|
8
|
+
import type { GitWorktreeAddInput, GitWorktreeAddOutput } from "../../../types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Add a working tree
|
|
11
|
+
*/
|
|
12
|
+
export declare function gitWorktreeAdd(input: GitWorktreeAddInput, ctx?: GitContext): Promise<GitWorktreeAddOutput>;
|
|
13
|
+
//# sourceMappingURL=add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../../src/procedures/git/worktree/add.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEnF;;GAEG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,mBAAmB,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAkBpH"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.worktree.add procedure
|
|
3
|
+
*
|
|
4
|
+
* Add a working tree (roadmap R40). Git refuses a folder that exists and is not empty. Without
|
|
5
|
+
* `ref`, `branch` and `detach`, git makes a branch with the name of the folder.
|
|
6
|
+
*/
|
|
7
|
+
import { resolve } from "node:path";
|
|
8
|
+
import { gitArg } from "../args.js";
|
|
9
|
+
import { git } from "../run.js";
|
|
10
|
+
import { currentBranch, headHash } from "../refs.js";
|
|
11
|
+
/**
|
|
12
|
+
* Add a working tree
|
|
13
|
+
*/
|
|
14
|
+
export async function gitWorktreeAdd(input, ctx = {}) {
|
|
15
|
+
const { ref, branch, detach, cwd } = input;
|
|
16
|
+
const path = resolve(cwd ?? process.cwd(), input.path);
|
|
17
|
+
const args = ["worktree", "add"];
|
|
18
|
+
if (branch)
|
|
19
|
+
args.push("-b", gitArg("branch", branch));
|
|
20
|
+
if (detach)
|
|
21
|
+
args.push("--detach");
|
|
22
|
+
// After "--", a path that starts with "-" stays a path
|
|
23
|
+
args.push("--", path);
|
|
24
|
+
if (ref)
|
|
25
|
+
args.push(gitArg("ref", ref));
|
|
26
|
+
await git(args, { cwd, signal: ctx.signal });
|
|
27
|
+
// The new working tree gives its own HEAD
|
|
28
|
+
const inTree = { cwd: path, signal: ctx.signal };
|
|
29
|
+
const result = { path, head: await headHash(inTree) };
|
|
30
|
+
const checkedOut = await currentBranch(inTree);
|
|
31
|
+
if (checkedOut !== "HEAD")
|
|
32
|
+
result.branch = checkedOut;
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../../src/procedures/git/worktree/add.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAmB,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGrD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAA0B,EAAE,GAAG,GAAe,EAAE;IACnF,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IAC3C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAEvD,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACjC,IAAI,MAAM;QAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,IAAI,MAAM;QAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAClC,uDAAuD;IACvD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACtB,IAAI,GAAG;QAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IACvC,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAE7C,0CAA0C;IAC1C,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IACjD,MAAM,MAAM,GAAyB,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;IAC5E,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;IAC/C,IAAI,UAAU,KAAK,MAAM;QAAE,MAAM,CAAC,MAAM,GAAG,UAAU,CAAC;IACtD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.worktree.list procedure
|
|
3
|
+
*
|
|
4
|
+
* List the working trees of the repository (roadmap R40). The main working tree is first.
|
|
5
|
+
*/
|
|
6
|
+
import { type GitContext } from "../run.js";
|
|
7
|
+
import type { GitWorktreeInfo, GitWorktreeListInput, GitWorktreeListOutput } from "../../../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* This function reads the output of `git worktree list --porcelain -z`: the fields of one working
|
|
10
|
+
* tree, then an empty field.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseWorktrees(output: string): GitWorktreeInfo[];
|
|
13
|
+
/**
|
|
14
|
+
* List the working trees of the repository
|
|
15
|
+
*/
|
|
16
|
+
export declare function gitWorktreeList(input: GitWorktreeListInput, ctx?: GitContext): Promise<GitWorktreeListOutput>;
|
|
17
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/procedures/git/worktree/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAEtG;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,EAAE,CAyBhE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,oBAAoB,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAGvH"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.worktree.list procedure
|
|
3
|
+
*
|
|
4
|
+
* List the working trees of the repository (roadmap R40). The main working tree is first.
|
|
5
|
+
*/
|
|
6
|
+
import { resolve } from "node:path";
|
|
7
|
+
import { git, zFields } from "../run.js";
|
|
8
|
+
/**
|
|
9
|
+
* This function reads the output of `git worktree list --porcelain -z`: the fields of one working
|
|
10
|
+
* tree, then an empty field.
|
|
11
|
+
*/
|
|
12
|
+
export function parseWorktrees(output) {
|
|
13
|
+
const worktrees = [];
|
|
14
|
+
let current;
|
|
15
|
+
for (const field of zFields(output)) {
|
|
16
|
+
if (field === "") {
|
|
17
|
+
current = undefined;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const space = field.indexOf(" ");
|
|
21
|
+
const key = space < 0 ? field : field.slice(0, space);
|
|
22
|
+
const value = space < 0 ? "" : field.slice(space + 1);
|
|
23
|
+
if (key === "worktree") {
|
|
24
|
+
// Git gives "/" on Windows too: resolve gives the path of the platform
|
|
25
|
+
current = { path: resolve(value), detached: false, bare: false, locked: false, prunable: false };
|
|
26
|
+
worktrees.push(current);
|
|
27
|
+
}
|
|
28
|
+
else if (current) {
|
|
29
|
+
if (key === "HEAD")
|
|
30
|
+
current.head = value;
|
|
31
|
+
else if (key === "branch")
|
|
32
|
+
current.branch = value.replace(/^refs\/heads\//, "");
|
|
33
|
+
else if (key === "detached")
|
|
34
|
+
current.detached = true;
|
|
35
|
+
else if (key === "bare")
|
|
36
|
+
current.bare = true;
|
|
37
|
+
else if (key === "locked")
|
|
38
|
+
current.locked = true;
|
|
39
|
+
else if (key === "prunable")
|
|
40
|
+
current.prunable = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return worktrees;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* List the working trees of the repository
|
|
47
|
+
*/
|
|
48
|
+
export async function gitWorktreeList(input, ctx = {}) {
|
|
49
|
+
const output = await git(["worktree", "list", "--porcelain", "-z"], { cwd: input.cwd, signal: ctx.signal });
|
|
50
|
+
return { worktrees: parseWorktrees(output) };
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/procedures/git/worktree/list.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAmB,MAAM,WAAW,CAAC;AAG1D;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc;IAC3C,MAAM,SAAS,GAAsB,EAAE,CAAC;IACxC,IAAI,OAAoC,CAAC;IACzC,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACpC,IAAI,KAAK,KAAK,EAAE,EAA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IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,KAA2B,EAAE,GAAG,GAAe,EAAE;IACrF,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5G,OAAO,EAAE,SAAS,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.worktree.remove procedure
|
|
3
|
+
*
|
|
4
|
+
* Remove a working tree and its folder (roadmap R40). Git refuses a working tree with changes
|
|
5
|
+
* that are not committed, unless `force` is true. Then the changes are lost.
|
|
6
|
+
*/
|
|
7
|
+
import { type GitContext } from "../run.js";
|
|
8
|
+
import type { GitWorktreeRemoveInput, GitWorktreeRemoveOutput } from "../../../types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Remove a working tree
|
|
11
|
+
*/
|
|
12
|
+
export declare function gitWorktreeRemove(input: GitWorktreeRemoveInput, ctx?: GitContext): Promise<GitWorktreeRemoveOutput>;
|
|
13
|
+
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../../src/procedures/git/worktree/remove.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAEzF;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAO7H"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.worktree.remove procedure
|
|
3
|
+
*
|
|
4
|
+
* Remove a working tree and its folder (roadmap R40). Git refuses a working tree with changes
|
|
5
|
+
* that are not committed, unless `force` is true. Then the changes are lost.
|
|
6
|
+
*/
|
|
7
|
+
import { git } from "../run.js";
|
|
8
|
+
/**
|
|
9
|
+
* Remove a working tree
|
|
10
|
+
*/
|
|
11
|
+
export async function gitWorktreeRemove(input, ctx = {}) {
|
|
12
|
+
const args = ["worktree", "remove"];
|
|
13
|
+
if (input.force)
|
|
14
|
+
args.push("--force");
|
|
15
|
+
// After "--", a path that starts with "-" stays a path
|
|
16
|
+
args.push("--", input.path);
|
|
17
|
+
await git(args, { cwd: input.cwd, signal: ctx.signal });
|
|
18
|
+
return { path: input.path };
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../../src/procedures/git/worktree/remove.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAmB,MAAM,WAAW,CAAC;AAGjD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,KAA6B,EAAE,GAAG,GAAe,EAAE;IACzF,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,uDAAuD;IACvD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5B,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IACxD,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AAC9B,CAAC"}
|