@procedures/git 0.2.2 → 0.3.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 +59 -0
- package/README.md +77 -12
- package/dist/.tsbuildinfo +1 -1
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +312 -2
- 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.map +1 -1
- package/dist/procedures/git/commit.js +9 -11
- 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/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/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 +308 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +265 -0
- package/dist/types.js.map +1 -1
- package/package.json +4 -4
- package/src/module.ts +411 -2
- 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 +9 -11
- 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/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/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 +623 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/procedures/git/branch/delete.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAmB,MAAM,WAAW,CAAC;AAG3D;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,KAA2B,EAAE,GAAG,GAAe,EAAE;IACrF,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,mGAAmG;IACnG,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,IAAI,WAAW,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CACnG,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,EACzB,CAAC,KAAc,EAAE,EAAE;QACjB,IAAI,KAAK,YAAY,QAAQ,IAAI,KAAK,CAAC,QAAQ,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,aAAa,CAAC,CAAC;QACrG,MAAM,KAAK,CAAC;IACd,CAAC,CACF,CAAC;IACF,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;IAC5D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.branch.list procedure
|
|
3
|
+
*
|
|
4
|
+
* List the branches (roadmap R40). It works in a repository without commits too: there are no
|
|
5
|
+
* branches yet, and `current` is the branch that HEAD names.
|
|
6
|
+
*/
|
|
7
|
+
import { type GitContext } from "../run.js";
|
|
8
|
+
import type { GitBranchListInput, GitBranchListOutput } from "../../../types.js";
|
|
9
|
+
/**
|
|
10
|
+
* List the branches
|
|
11
|
+
*/
|
|
12
|
+
export declare function gitBranchList(input: GitBranchListInput, ctx?: GitContext): Promise<GitBranchListOutput>;
|
|
13
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/procedures/git/branch/list.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EAAiB,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEhG;;GAEG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAyBjH"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.branch.list procedure
|
|
3
|
+
*
|
|
4
|
+
* List the branches (roadmap R40). It works in a repository without commits too: there are no
|
|
5
|
+
* branches yet, and `current` is the branch that HEAD names.
|
|
6
|
+
*/
|
|
7
|
+
import { git } from "../run.js";
|
|
8
|
+
import { currentBranch } from "../refs.js";
|
|
9
|
+
/**
|
|
10
|
+
* List the branches
|
|
11
|
+
*/
|
|
12
|
+
export async function gitBranchList(input, ctx = {}) {
|
|
13
|
+
const run = { cwd: input.cwd, signal: ctx.signal };
|
|
14
|
+
const current = await currentBranch(run);
|
|
15
|
+
const args = ["branch"];
|
|
16
|
+
if (input.remote)
|
|
17
|
+
args.push("-a");
|
|
18
|
+
// The full ref name tells local from remote branches: a local "feature/x" also contains "/"
|
|
19
|
+
args.push("--format=%(refname)|%(refname:short)|%(HEAD)|%(upstream:short)");
|
|
20
|
+
const output = await git(args, run);
|
|
21
|
+
const branches = output
|
|
22
|
+
.split("\n")
|
|
23
|
+
.filter(Boolean)
|
|
24
|
+
.map((line) => {
|
|
25
|
+
const [fullName = "", branchName = "", head = "", tracking = ""] = line.split("|");
|
|
26
|
+
const result = {
|
|
27
|
+
name: branchName.replace(/^remotes\//, ""),
|
|
28
|
+
current: head === "*",
|
|
29
|
+
remote: fullName.startsWith("refs/remotes/"),
|
|
30
|
+
};
|
|
31
|
+
if (tracking)
|
|
32
|
+
result.tracking = tracking;
|
|
33
|
+
return result;
|
|
34
|
+
});
|
|
35
|
+
return { branches, current };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/procedures/git/branch/list.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAmB,MAAM,WAAW,CAAC;AACjD,OA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}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* git.branch procedure
|
|
2
|
+
* git.branch procedure (deprecated)
|
|
3
3
|
*
|
|
4
|
-
* Branch operations
|
|
4
|
+
* Branch operations. Since roadmap R40, git.branch.list, git.branch.add and git.branch.delete do
|
|
5
|
+
* this, one procedure for each operation. This procedure stays for one release, and calls them.
|
|
6
|
+
* Its inputs and outputs do not change. The current branch comes from `git symbolic-ref`, so a
|
|
7
|
+
* repository without commits works now too (before, `git rev-parse --abbrev-ref HEAD` failed).
|
|
5
8
|
*/
|
|
6
9
|
import { type GitContext } from "./run.js";
|
|
7
10
|
import type { GitBranchInput, GitBranchOutput } from "../../types.js";
|
|
8
11
|
/**
|
|
9
12
|
* Branch operations
|
|
13
|
+
*
|
|
14
|
+
* @deprecated Use `gitBranchList`, `gitBranchAdd` or `gitBranchDelete` (git.branch.list,
|
|
15
|
+
* git.branch.add, git.branch.delete).
|
|
10
16
|
*/
|
|
11
17
|
export declare function gitBranch(input: GitBranchInput, ctx?: GitContext): Promise<GitBranchOutput>;
|
|
12
18
|
//# sourceMappingURL=branch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/procedures/git/branch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../../src/procedures/git/branch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAK3C,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtE;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAiBrG"}
|
|
@@ -1,54 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* git.branch procedure
|
|
2
|
+
* git.branch procedure (deprecated)
|
|
3
3
|
*
|
|
4
|
-
* Branch operations
|
|
4
|
+
* Branch operations. Since roadmap R40, git.branch.list, git.branch.add and git.branch.delete do
|
|
5
|
+
* this, one procedure for each operation. This procedure stays for one release, and calls them.
|
|
6
|
+
* Its inputs and outputs do not change. The current branch comes from `git symbolic-ref`, so a
|
|
7
|
+
* repository without commits works now too (before, `git rev-parse --abbrev-ref HEAD` failed).
|
|
5
8
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
9
|
+
import {} from "./run.js";
|
|
10
|
+
import { currentBranch } from "./refs.js";
|
|
11
|
+
import { gitBranchList } from "./branch/list.js";
|
|
12
|
+
import { gitBranchAdd } from "./branch/add.js";
|
|
13
|
+
import { gitBranchDelete } from "./branch/delete.js";
|
|
8
14
|
/**
|
|
9
15
|
* Branch operations
|
|
16
|
+
*
|
|
17
|
+
* @deprecated Use `gitBranchList`, `gitBranchAdd` or `gitBranchDelete` (git.branch.list,
|
|
18
|
+
* git.branch.add, git.branch.delete).
|
|
10
19
|
*/
|
|
11
20
|
export async function gitBranch(input, ctx = {}) {
|
|
12
21
|
const { name, delete: del, list, remote, cwd } = input;
|
|
13
|
-
const run = { cwd, signal: ctx.signal };
|
|
14
|
-
// Get current branch
|
|
15
|
-
const current = (await git(["rev-parse", "--abbrev-ref", "HEAD"], run)).trim();
|
|
16
22
|
// Delete branch
|
|
17
23
|
if (del && name) {
|
|
18
|
-
await
|
|
19
|
-
return { deleted: name, current };
|
|
24
|
+
await gitBranchDelete({ name, cwd }, ctx);
|
|
25
|
+
return { deleted: name, current: await currentBranch({ cwd, signal: ctx.signal }) };
|
|
20
26
|
}
|
|
21
27
|
// Create branch
|
|
22
28
|
if (name && !list) {
|
|
23
|
-
await
|
|
24
|
-
return { created: name, current };
|
|
29
|
+
await gitBranchAdd({ name, cwd }, ctx);
|
|
30
|
+
return { created: name, current: await currentBranch({ cwd, signal: ctx.signal }) };
|
|
25
31
|
}
|
|
26
32
|
// List branches
|
|
27
|
-
|
|
28
|
-
if (remote)
|
|
29
|
-
args.push("-a");
|
|
30
|
-
// The full ref name tells local from remote branches: a local "feature/x" also contains "/"
|
|
31
|
-
args.push("--format=%(refname)|%(refname:short)|%(HEAD)|%(upstream:short)");
|
|
32
|
-
const output = await git(args, run);
|
|
33
|
-
const branches = output
|
|
34
|
-
.split("\n")
|
|
35
|
-
.filter(Boolean)
|
|
36
|
-
.map(line => {
|
|
37
|
-
const parts = line.split("|");
|
|
38
|
-
const fullName = parts[0] ?? "";
|
|
39
|
-
const branchName = parts[1] ?? "";
|
|
40
|
-
const head = parts[2] ?? "";
|
|
41
|
-
const trackingVal = parts[3];
|
|
42
|
-
const result = {
|
|
43
|
-
name: branchName.replace(/^remotes\//, ""),
|
|
44
|
-
current: head === "*",
|
|
45
|
-
remote: fullName.startsWith("refs/remotes/"),
|
|
46
|
-
};
|
|
47
|
-
if (trackingVal) {
|
|
48
|
-
result.tracking = trackingVal;
|
|
49
|
-
}
|
|
50
|
-
return result;
|
|
51
|
-
});
|
|
52
|
-
return { branches, current };
|
|
33
|
+
return gitBranchList({ remote, cwd }, ctx);
|
|
53
34
|
}
|
|
54
35
|
//# sourceMappingURL=branch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.js","sourceRoot":"","sources":["../../../src/procedures/git/branch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"branch.js","sourceRoot":"","sources":["../../../src/procedures/git/branch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAmB,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD;;;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Ae,CAAC,
|
|
1
|
+
{"version":3,"file":"commit.d.ts","sourceRoot":"","sources":["../../../src/procedures/git/commit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtE;;GAEG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CA+BrG"}
|
|
@@ -10,20 +10,18 @@ import { git } from "./run.js";
|
|
|
10
10
|
export async function gitCommit(input, ctx = {}) {
|
|
11
11
|
const { message, all, amend, cwd } = input;
|
|
12
12
|
const run = { cwd, signal: ctx.signal };
|
|
13
|
-
// Check if there's anything to commit (unless amending)
|
|
13
|
+
// Check if there's anything to commit (unless amending). Each line of `git status --porcelain`
|
|
14
|
+
// is "XY path": X is the index, Y the work tree, "??" an untracked file. Without -a, only a
|
|
15
|
+
// staged change counts. With -a, a change of a tracked file counts too. An untracked file is
|
|
16
|
+
// never a change to commit. (Before, any line counted, so an untracked file or an unstaged
|
|
17
|
+
// change made git commit fail with "nothing added to commit": roadmap R33.)
|
|
14
18
|
if (!amend) {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
const lines = (await git(["status", "--porcelain"], run)).split("\n").filter((line) => line.length > 0);
|
|
20
|
+
const tracked = lines.filter((line) => !line.startsWith("??") && !line.startsWith("!!"));
|
|
21
|
+
const staged = tracked.filter((line) => line[0] !== " ");
|
|
22
|
+
if ((all ? tracked : staged).length === 0) {
|
|
18
23
|
return { hash: "", message: "", author: "", date: "", skipped: true };
|
|
19
24
|
}
|
|
20
|
-
// If using -a, check if there are any modified files
|
|
21
|
-
if (all) {
|
|
22
|
-
const hasChanges = status.length > 0;
|
|
23
|
-
if (!hasChanges) {
|
|
24
|
-
return { hash: "", message: "", author: "", date: "", skipped: true };
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
25
|
}
|
|
28
26
|
const args = ["commit"];
|
|
29
27
|
if (all)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commit.js","sourceRoot":"","sources":["../../../src/procedures/git/commit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAmB,MAAM,UAAU,CAAC;AAGhD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAqB,EAAE,GAAG,GAAe,EAAE;IACzE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IAC3C,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IAExC,
|
|
1
|
+
{"version":3,"file":"commit.js","sourceRoot":"","sources":["../../../src/procedures/git/commit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAmB,MAAM,UAAU,CAAC;AAGhD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAqB,EAAE,GAAG,GAAe,EAAE;IACzE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IAC3C,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IAExC,+FAA+F;IAC/F,4FAA4F;IAC5F,6FAA6F;IAC7F,2FAA2F;IAC3F,4EAA4E;IAC5E,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAA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IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEvE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -12,4 +12,23 @@ export { gitInit } from "./init.js";
|
|
|
12
12
|
export { gitRemote, gitRemoteSet } from "./remote.js";
|
|
13
13
|
export { gitFetch } from "./fetch.js";
|
|
14
14
|
export { gitStashList, gitStashPush, gitStashPop, gitStashApply, gitStashDrop, gitStashExport, gitStashImport, } from "./stash.js";
|
|
15
|
+
export { gitShow } from "./show.js";
|
|
16
|
+
export { gitBlame } from "./blame.js";
|
|
17
|
+
export { gitTagList } from "./tag/list.js";
|
|
18
|
+
export { gitTagAdd } from "./tag/add.js";
|
|
19
|
+
export { gitTagDelete } from "./tag/delete.js";
|
|
20
|
+
export { gitRevParse } from "./revParse.js";
|
|
21
|
+
export { gitReset } from "./reset.js";
|
|
22
|
+
export { gitRestore } from "./restore.js";
|
|
23
|
+
export { gitMerge } from "./merge.js";
|
|
24
|
+
export { gitMergeAbort } from "./merge/abort.js";
|
|
25
|
+
export { gitRebase } from "./rebase.js";
|
|
26
|
+
export { gitRebaseContinue } from "./rebase/continue.js";
|
|
27
|
+
export { gitRebaseAbort } from "./rebase/abort.js";
|
|
28
|
+
export { gitWorktreeList } from "./worktree/list.js";
|
|
29
|
+
export { gitWorktreeAdd } from "./worktree/add.js";
|
|
30
|
+
export { gitWorktreeRemove } from "./worktree/remove.js";
|
|
31
|
+
export { gitBranchList } from "./branch/list.js";
|
|
32
|
+
export { gitBranchAdd } from "./branch/add.js";
|
|
33
|
+
export { gitBranchDelete } from "./branch/delete.js";
|
|
15
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/procedures/git/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa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AAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -12,4 +12,23 @@ export { gitInit } from "./init.js";
|
|
|
12
12
|
export { gitRemote, gitRemoteSet } from "./remote.js";
|
|
13
13
|
export { gitFetch } from "./fetch.js";
|
|
14
14
|
export { gitStashList, gitStashPush, gitStashPop, gitStashApply, gitStashDrop, gitStashExport, gitStashImport, } from "./stash.js";
|
|
15
|
+
export { gitShow } from "./show.js";
|
|
16
|
+
export { gitBlame } from "./blame.js";
|
|
17
|
+
export { gitTagList } from "./tag/list.js";
|
|
18
|
+
export { gitTagAdd } from "./tag/add.js";
|
|
19
|
+
export { gitTagDelete } from "./tag/delete.js";
|
|
20
|
+
export { gitRevParse } from "./revParse.js";
|
|
21
|
+
export { gitReset } from "./reset.js";
|
|
22
|
+
export { gitRestore } from "./restore.js";
|
|
23
|
+
export { gitMerge } from "./merge.js";
|
|
24
|
+
export { gitMergeAbort } from "./merge/abort.js";
|
|
25
|
+
export { gitRebase } from "./rebase.js";
|
|
26
|
+
export { gitRebaseContinue } from "./rebase/continue.js";
|
|
27
|
+
export { gitRebaseAbort } from "./rebase/abort.js";
|
|
28
|
+
export { gitWorktreeList } from "./worktree/list.js";
|
|
29
|
+
export { gitWorktreeAdd } from "./worktree/add.js";
|
|
30
|
+
export { gitWorktreeRemove } from "./worktree/remove.js";
|
|
31
|
+
export { gitBranchList } from "./branch/list.js";
|
|
32
|
+
export { gitBranchAdd } from "./branch/add.js";
|
|
33
|
+
export { gitBranchDelete } from "./branch/delete.js";
|
|
15
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/procedures/git/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;A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|
|
4
4
|
* Initialize a git repository
|
|
5
|
+
*
|
|
6
|
+
* The procedure looks for `.git` in the folder itself. Before, it called `fs.exists` through
|
|
7
|
+
* `ctx.client`, so a registry of `gitModule` alone (`createRegistry(gitModule)`) did not have the
|
|
8
|
+
* procedure that it called, and `git.init` always failed there (roadmap R33).
|
|
5
9
|
*/
|
|
6
|
-
import type
|
|
10
|
+
import { type GitContext } from "./run.js";
|
|
7
11
|
import type { GitInitInput, GitInitOutput } from "../../types.js";
|
|
8
12
|
/**
|
|
9
13
|
* Initialize a git repository
|
|
10
14
|
*/
|
|
11
|
-
export declare function gitInit(input: GitInitInput, ctx
|
|
15
|
+
export declare function gitInit(input: GitInitInput, ctx?: GitContext): Promise<GitInitOutput>;
|
|
12
16
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/procedures/git/init.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/procedures/git/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAElE;;GAEG;AACH,wBAAsB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,aAAa,CAAC,CAyB/F"}
|
|
@@ -2,18 +2,22 @@
|
|
|
2
2
|
* git.init procedure
|
|
3
3
|
*
|
|
4
4
|
* Initialize a git repository
|
|
5
|
+
*
|
|
6
|
+
* The procedure looks for `.git` in the folder itself. Before, it called `fs.exists` through
|
|
7
|
+
* `ctx.client`, so a registry of `gitModule` alone (`createRegistry(gitModule)`) did not have the
|
|
8
|
+
* procedure that it called, and `git.init` always failed there (roadmap R33).
|
|
5
9
|
*/
|
|
10
|
+
import { access } from "node:fs/promises";
|
|
6
11
|
import { join, resolve } from "node:path";
|
|
7
12
|
import { git } from "./run.js";
|
|
8
13
|
/**
|
|
9
14
|
* Initialize a git repository
|
|
10
15
|
*/
|
|
11
|
-
export async function gitInit(input, ctx) {
|
|
16
|
+
export async function gitInit(input, ctx = {}) {
|
|
12
17
|
const cwd = input.cwd ? resolve(input.cwd) : process.cwd();
|
|
13
|
-
// Check if already a git repo
|
|
18
|
+
// Check if already a git repo (as fs.exists did: an error of the check means "no")
|
|
14
19
|
const gitDir = join(cwd, ".git");
|
|
15
|
-
const
|
|
16
|
-
const alreadyExists = existsResult.exists;
|
|
20
|
+
const alreadyExists = await access(gitDir).then(() => true, () => false);
|
|
17
21
|
if (!alreadyExists) {
|
|
18
22
|
const args = ["init"];
|
|
19
23
|
if (input.bare) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/procedures/git/init.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/procedures/git/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAmB,MAAM,UAAU,CAAC;AAGhD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,KAAmB,EAAE,GAAG,GAAe,EAAE;IACrE,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAE3D,mFAAmF;IACnF,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACjC,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAC7C,GAAG,EAAE,CAAC,IAAI,EACV,GAAG,EAAE,CAAC,KAAK,CACZ,CAAC;IAEF,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,MAAM,IAAI,GAAa,CAAC,MAAM,CAAC,CAAC;QAChC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;YACf,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtB,CAAC;QACD,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,oBAAoB,KAAK,CAAC,aAAa,EAAE,CAAC,CAAC;QACvD,CAAC;QACD,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO;QACL,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,CAAC,aAAa;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.merge.abort procedure
|
|
3
|
+
*
|
|
4
|
+
* Stop a merge that has conflicts (roadmap R40). Git puts back the branch and the files as they
|
|
5
|
+
* were before the merge. The resolutions of the conflicts are lost. Without a merge, the call
|
|
6
|
+
* fails.
|
|
7
|
+
*/
|
|
8
|
+
import { type GitContext } from "../run.js";
|
|
9
|
+
import type { GitMergeAbortInput, GitMergeAbortOutput } from "../../../types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Stop a merge that has conflicts
|
|
12
|
+
*/
|
|
13
|
+
export declare function gitMergeAbort(input: GitMergeAbortInput, ctx?: GitContext): Promise<GitMergeAbortOutput>;
|
|
14
|
+
//# sourceMappingURL=abort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../../../src/procedures/git/merge/abort.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEjF;;GAEG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAIjH"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.merge.abort procedure
|
|
3
|
+
*
|
|
4
|
+
* Stop a merge that has conflicts (roadmap R40). Git puts back the branch and the files as they
|
|
5
|
+
* were before the merge. The resolutions of the conflicts are lost. Without a merge, the call
|
|
6
|
+
* fails.
|
|
7
|
+
*/
|
|
8
|
+
import { git } from "../run.js";
|
|
9
|
+
import { headHash } from "../refs.js";
|
|
10
|
+
/**
|
|
11
|
+
* Stop a merge that has conflicts
|
|
12
|
+
*/
|
|
13
|
+
export async function gitMergeAbort(input, ctx = {}) {
|
|
14
|
+
const run = { cwd: input.cwd, signal: ctx.signal };
|
|
15
|
+
await git(["merge", "--abort"], run);
|
|
16
|
+
return { aborted: true, hash: await headHash(run) };
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=abort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.js","sourceRoot":"","sources":["../../../../src/procedures/git/merge/abort.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,GAAG,EAAmB,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAyB,EAAE,GAAG,GAAe,EAAE;IACjF,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IACnD,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC;IACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.merge procedure
|
|
3
|
+
*
|
|
4
|
+
* Merge a branch or a commit into the current branch (roadmap R40).
|
|
5
|
+
*
|
|
6
|
+
* A merge that stops on conflicts is a result, not an error: `conflict` is true, and `conflicts`
|
|
7
|
+
* names the files. Then resolve them and call git.commit, or call git.merge.abort. Git does not
|
|
8
|
+
* start an editor for the message of the merge commit.
|
|
9
|
+
*/
|
|
10
|
+
import { type GitContext } from "./run.js";
|
|
11
|
+
import type { GitMergeInput, GitMergeOutput } from "../../types.js";
|
|
12
|
+
/**
|
|
13
|
+
* Merge a branch or a commit into the current branch
|
|
14
|
+
*/
|
|
15
|
+
export declare function gitMerge(input: GitMergeInput, ctx?: GitContext): Promise<GitMergeOutput>;
|
|
16
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/procedures/git/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAO,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEpE;;GAEG;AACH,wBAAsB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAuBlG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.merge procedure
|
|
3
|
+
*
|
|
4
|
+
* Merge a branch or a commit into the current branch (roadmap R40).
|
|
5
|
+
*
|
|
6
|
+
* A merge that stops on conflicts is a result, not an error: `conflict` is true, and `conflicts`
|
|
7
|
+
* names the files. Then resolve them and call git.commit, or call git.merge.abort. Git does not
|
|
8
|
+
* start an editor for the message of the merge commit.
|
|
9
|
+
*/
|
|
10
|
+
import { gitArg } from "./args.js";
|
|
11
|
+
import { git } from "./run.js";
|
|
12
|
+
import { commitOf, conflictedFiles, headHash, NO_EDITOR, stoppedOnConflict } from "./refs.js";
|
|
13
|
+
/**
|
|
14
|
+
* Merge a branch or a commit into the current branch
|
|
15
|
+
*/
|
|
16
|
+
export async function gitMerge(input, ctx = {}) {
|
|
17
|
+
const { ref, message, cwd } = input;
|
|
18
|
+
const fastForward = input.fastForward ?? "auto";
|
|
19
|
+
const run = { cwd, signal: ctx.signal };
|
|
20
|
+
const target = await commitOf(ref, run);
|
|
21
|
+
const before = await headHash(run);
|
|
22
|
+
const args = ["merge", "--no-edit"];
|
|
23
|
+
if (fastForward === "only")
|
|
24
|
+
args.push("--ff-only");
|
|
25
|
+
if (fastForward === "never")
|
|
26
|
+
args.push("--no-ff");
|
|
27
|
+
if (message !== undefined)
|
|
28
|
+
args.push("-m", message);
|
|
29
|
+
args.push(gitArg("ref", ref));
|
|
30
|
+
try {
|
|
31
|
+
await git(args, { ...run, env: NO_EDITOR });
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
if (!stoppedOnConflict(error))
|
|
35
|
+
throw error;
|
|
36
|
+
return { ref, hash: before, fastForward: false, upToDate: false, conflict: true, conflicts: await conflictedFiles(run) };
|
|
37
|
+
}
|
|
38
|
+
const after = await headHash(run);
|
|
39
|
+
return { ref, hash: after, fastForward: after !== before && after === target, upToDate: after === before, conflict: false };
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../../src/procedures/git/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAA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;QAC3C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC;IAC3H,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,MAAM,EAAE,QAAQ,EAAE,KAAK,KAAK,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC9H,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../src/procedures/git/push.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../../src/procedures/git/push.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAElE;;GAEG;AACH,wBAAsB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,GAAE,UAAe,GAAG,OAAO,CAAC,aAAa,CAAC,CA6B/F"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { gitArg } from "./args.js";
|
|
7
7
|
import { git, GitError } from "./run.js";
|
|
8
|
+
import { currentBranch } from "./refs.js";
|
|
8
9
|
/**
|
|
9
10
|
* Push to remote
|
|
10
11
|
*/
|
|
@@ -12,8 +13,9 @@ export async function gitPush(input, ctx = {}) {
|
|
|
12
13
|
const { branch, force, setUpstream, cwd } = input;
|
|
13
14
|
const remoteName = input.remote ?? "origin";
|
|
14
15
|
const run = { cwd, signal: ctx.signal };
|
|
15
|
-
//
|
|
16
|
-
|
|
16
|
+
// The current branch if not specified. `git symbolic-ref` reads it in a repository without
|
|
17
|
+
// commits too, so git gives its own error there (roadmap R40).
|
|
18
|
+
const branchName = branch || (await currentBranch(run));
|
|
17
19
|
// Count commits to push
|
|
18
20
|
let commits = 0;
|
|
19
21
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../../src/procedures/git/push.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAmB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"push.js","sourceRoot":"","sources":["../../../src/procedures/git/push.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAmB,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,KAAmB,EAAE,GAAG,GAAe,EAAE;IACrE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;IAClD,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,IAAI,QAAQ,CAAC;IAC5C,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IAExC,2FAA2F;IAC3F,+DAA+D;IAC/D,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IAExD,wBAAwB;IACxB,IAA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
5
|
+
* resolutions of the conflicts are lost. Without a rebase, the call fails.
|
|
6
|
+
*/
|
|
7
|
+
import { type GitContext } from "../run.js";
|
|
8
|
+
import type { GitRebaseAbortInput, GitRebaseAbortOutput } from "../../../types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Stop a rebase, and go back to the branch before it
|
|
11
|
+
*/
|
|
12
|
+
export declare function gitRebaseAbort(input: GitRebaseAbortInput, ctx?: GitContext): Promise<GitRebaseAbortOutput>;
|
|
13
|
+
//# sourceMappingURL=abort.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.d.ts","sourceRoot":"","sources":["../../../../src/procedures/git/rebase/abort.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,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,CAIpH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.rebase.abort procedure
|
|
3
|
+
*
|
|
4
|
+
* Stop a rebase, and go back to the branch as it was before the rebase (roadmap R40). The
|
|
5
|
+
* resolutions of the conflicts are lost. Without a rebase, the call fails.
|
|
6
|
+
*/
|
|
7
|
+
import { git } from "../run.js";
|
|
8
|
+
import { headHash } from "../refs.js";
|
|
9
|
+
/**
|
|
10
|
+
* Stop a rebase, and go back to the branch before it
|
|
11
|
+
*/
|
|
12
|
+
export async function gitRebaseAbort(input, ctx = {}) {
|
|
13
|
+
const run = { cwd: input.cwd, signal: ctx.signal };
|
|
14
|
+
await git(["rebase", "--abort"], run);
|
|
15
|
+
return { aborted: true, hash: await headHash(run) };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=abort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.js","sourceRoot":"","sources":["../../../../src/procedures/git/rebase/abort.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAmB,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAA0B,EAAE,GAAG,GAAe,EAAE;IACnF,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IACnD,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC;IACtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.rebase.continue procedure
|
|
3
|
+
*
|
|
4
|
+
* Continue a rebase after the conflicts are resolved and staged (roadmap R40). Git keeps the
|
|
5
|
+
* message of each commit: it does not start an editor. A next commit can stop on conflicts again.
|
|
6
|
+
*/
|
|
7
|
+
import { type GitContext } from "../run.js";
|
|
8
|
+
import type { GitRebaseContinueInput, GitRebaseContinueOutput } from "../../../types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Continue a rebase after the conflicts are resolved
|
|
11
|
+
*/
|
|
12
|
+
export declare function gitRebaseContinue(input: GitRebaseContinueInput, ctx?: GitContext): Promise<GitRebaseContinueOutput>;
|
|
13
|
+
//# sourceMappingURL=continue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continue.d.ts","sourceRoot":"","sources":["../../../../src/procedures/git/rebase/continue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5C,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,CAS7H"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* git.rebase.continue procedure
|
|
3
|
+
*
|
|
4
|
+
* Continue a rebase after the conflicts are resolved and staged (roadmap R40). Git keeps the
|
|
5
|
+
* message of each commit: it does not start an editor. A next commit can stop on conflicts again.
|
|
6
|
+
*/
|
|
7
|
+
import {} from "../run.js";
|
|
8
|
+
import { conflictedFiles, headHash } from "../refs.js";
|
|
9
|
+
import { rebaseStep } from "../rebase.js";
|
|
10
|
+
/**
|
|
11
|
+
* Continue a rebase after the conflicts are resolved
|
|
12
|
+
*/
|
|
13
|
+
export async function gitRebaseContinue(input, ctx = {}) {
|
|
14
|
+
const run = { cwd: input.cwd, signal: ctx.signal };
|
|
15
|
+
// Files that still have conflicts: git refuses to continue, so the call gives them
|
|
16
|
+
const unresolved = await conflictedFiles(run);
|
|
17
|
+
if (unresolved.length > 0) {
|
|
18
|
+
return { hash: await headHash(run), completed: false, upToDate: false, conflict: true, conflicts: unresolved };
|
|
19
|
+
}
|
|
20
|
+
// A continued rebase changed the branch: upToDate is false
|
|
21
|
+
return rebaseStep(["rebase", "--continue"], "", run);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=continue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continue.js","sourceRoot":"","sources":["../../../../src/procedures/git/rebase/continue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAmB,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,KAA6B,EAAE,GAAG,GAAe,EAAE;IACzF,MAAM,GAAG,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IACnD,mFAAmF;IACnF,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC,GAAG,CAAC,CAAC;IAC9C,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;IACjH,CAAC;IACD,2DAA2D;IAC3D,OAAO,UAAU,CAAC,CAAC,QAAQ,EAAE,YAAY,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;AACvD,CAAC"}
|