git-stack-cli 2.4.1 → 2.5.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/dist/js/index.js +46 -7
- package/package.json +1 -1
- package/src/command.ts +21 -5
- package/src/core/GitReviseTodo.ts +27 -5
package/dist/js/index.js
CHANGED
|
@@ -38415,6 +38415,8 @@ GitReviseTodo.todo = function todo(args) {
|
|
|
38415
38415
|
return todo2;
|
|
38416
38416
|
};
|
|
38417
38417
|
GitReviseTodo.execute = async function grt_execute(args) {
|
|
38418
|
+
const argv = Store.getState().argv;
|
|
38419
|
+
const actions = Store.getState().actions;
|
|
38418
38420
|
const GIT_SEQUENCE_EDITOR_SCRIPT = `#!/bin/sh
|
|
38419
38421
|
|
|
38420
38422
|
# Example
|
|
@@ -38472,10 +38474,30 @@ echo
|
|
|
38472
38474
|
const command = [
|
|
38473
38475
|
`GIT_EDITOR="${tmp_git_sequence_editor_path}"`,
|
|
38474
38476
|
`GIT_REVISE_TODO="${tmp_path_git_revise_todo}"`,
|
|
38475
|
-
`git
|
|
38476
|
-
`revise --edit -i ${args.rebase_merge_base}`
|
|
38477
|
+
`git`
|
|
38477
38478
|
];
|
|
38478
|
-
|
|
38479
|
+
if (!argv["revise-sign"]) {
|
|
38480
|
+
command.push(...["-c", "commit.gpgsign=false"]);
|
|
38481
|
+
}
|
|
38482
|
+
command.push(`revise --edit -i ${args.rebase_merge_base}`);
|
|
38483
|
+
try {
|
|
38484
|
+
await cli(command, { stdio: ["pipe", "pipe", "pipe"] });
|
|
38485
|
+
} catch (err) {
|
|
38486
|
+
if (err instanceof Error) {
|
|
38487
|
+
actions.error(err.message);
|
|
38488
|
+
if (err.message.includes("gpg failed to sign commit")) {
|
|
38489
|
+
actions.error(`
|
|
38490
|
+
|
|
38491
|
+
`);
|
|
38492
|
+
actions.error("\uD83D\uDEA8 git revise failed to sign commit");
|
|
38493
|
+
actions.error("\uD83D\uDCA1 Try again with `--no-revise-sign`?");
|
|
38494
|
+
actions.error(`
|
|
38495
|
+
|
|
38496
|
+
`);
|
|
38497
|
+
actions.exit(21);
|
|
38498
|
+
}
|
|
38499
|
+
}
|
|
38500
|
+
}
|
|
38479
38501
|
await safe_rm(tmp_git_sequence_editor_path);
|
|
38480
38502
|
};
|
|
38481
38503
|
|
|
@@ -45662,7 +45684,7 @@ var yargs_default = Yargs;
|
|
|
45662
45684
|
|
|
45663
45685
|
// src/command.ts
|
|
45664
45686
|
async function command2() {
|
|
45665
|
-
return yargs_default(hideBin(process.argv)).scriptName("git stack").usage("Usage: git stack [command] [options]").command("$0", "Sync commit ranges to Github", (yargs) => yargs.options(DefaultOptions)).command("fixup [commit]", "Amend staged changes to a specific commit in history", (yargs) => yargs.positional("commit", FixupOptions.commit)).command("log [args...]", "Print an abbreviated log with numbered commits, useful for git stack fixup", (yargs) => yargs.strict(false)).command("rebase", "Update local branch via rebase with latest changes from origin master branch", (yargs) => yargs).option("verbose", GlobalOptions.verbose).wrap(123).strict().version("2.
|
|
45687
|
+
return yargs_default(hideBin(process.argv)).scriptName("git stack").usage("Usage: git stack [command] [options]").command("$0", "Sync commit ranges to Github", (yargs) => yargs.options(DefaultOptions)).command("fixup [commit]", "Amend staged changes to a specific commit in history", (yargs) => yargs.positional("commit", FixupOptions.commit)).command("log [args...]", "Print an abbreviated log with numbered commits, useful for git stack fixup", (yargs) => yargs.strict(false)).command("rebase", "Update local branch via rebase with latest changes from origin master branch", (yargs) => yargs).option("verbose", GlobalOptions.verbose).wrap(123).strict().version("2.5.0").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
|
|
45666
45688
|
}
|
|
45667
45689
|
var GlobalOptions = {
|
|
45668
45690
|
verbose: {
|
|
@@ -45694,7 +45716,11 @@ var DefaultOptions = {
|
|
|
45694
45716
|
verify: {
|
|
45695
45717
|
type: "boolean",
|
|
45696
45718
|
default: true,
|
|
45697
|
-
description:
|
|
45719
|
+
description: [
|
|
45720
|
+
"Run git hooks such as pre-commit and pre-push",
|
|
45721
|
+
"Disable with --no-verify"
|
|
45722
|
+
].join(`
|
|
45723
|
+
`)
|
|
45698
45724
|
},
|
|
45699
45725
|
update: {
|
|
45700
45726
|
type: "boolean",
|
|
@@ -45705,7 +45731,11 @@ var DefaultOptions = {
|
|
|
45705
45731
|
branch: {
|
|
45706
45732
|
type: "string",
|
|
45707
45733
|
alias: ["b"],
|
|
45708
|
-
description:
|
|
45734
|
+
description: [
|
|
45735
|
+
"Set the master branch name, defaults to 'origin/master'",
|
|
45736
|
+
"(or 'origin/main' if 'origin/master' is not found)"
|
|
45737
|
+
].join(`
|
|
45738
|
+
`)
|
|
45709
45739
|
},
|
|
45710
45740
|
draft: {
|
|
45711
45741
|
type: "boolean",
|
|
@@ -45718,10 +45748,19 @@ var DefaultOptions = {
|
|
|
45718
45748
|
default: "",
|
|
45719
45749
|
description: "Prefix for generated branch names, e.g. dev/magus/"
|
|
45720
45750
|
},
|
|
45751
|
+
"revise-sign": {
|
|
45752
|
+
type: "boolean",
|
|
45753
|
+
default: true,
|
|
45754
|
+
description: "Disable GPG signing for git revise with --no-revise-sign"
|
|
45755
|
+
},
|
|
45721
45756
|
template: {
|
|
45722
45757
|
type: "boolean",
|
|
45723
45758
|
default: true,
|
|
45724
|
-
description:
|
|
45759
|
+
description: [
|
|
45760
|
+
"Use automatic Github PR template, e.g. .github/pull_request_template.md",
|
|
45761
|
+
"Disable with --no-template"
|
|
45762
|
+
].join(`
|
|
45763
|
+
`)
|
|
45725
45764
|
},
|
|
45726
45765
|
"write-state-json": {
|
|
45727
45766
|
hidden: true,
|
package/package.json
CHANGED
package/src/command.ts
CHANGED
|
@@ -79,7 +79,11 @@ const DefaultOptions = {
|
|
|
79
79
|
"verify": {
|
|
80
80
|
type: "boolean",
|
|
81
81
|
default: true,
|
|
82
|
-
description:
|
|
82
|
+
description: [
|
|
83
|
+
// force line break
|
|
84
|
+
"Run git hooks such as pre-commit and pre-push",
|
|
85
|
+
"Disable with --no-verify",
|
|
86
|
+
].join("\n"),
|
|
83
87
|
},
|
|
84
88
|
|
|
85
89
|
"update": {
|
|
@@ -92,8 +96,11 @@ const DefaultOptions = {
|
|
|
92
96
|
"branch": {
|
|
93
97
|
type: "string",
|
|
94
98
|
alias: ["b"],
|
|
95
|
-
description:
|
|
96
|
-
|
|
99
|
+
description: [
|
|
100
|
+
// force line break
|
|
101
|
+
"Set the master branch name, defaults to 'origin/master'",
|
|
102
|
+
"(or 'origin/main' if 'origin/master' is not found)",
|
|
103
|
+
].join("\n"),
|
|
97
104
|
},
|
|
98
105
|
|
|
99
106
|
"draft": {
|
|
@@ -109,11 +116,20 @@ const DefaultOptions = {
|
|
|
109
116
|
description: "Prefix for generated branch names, e.g. dev/magus/",
|
|
110
117
|
},
|
|
111
118
|
|
|
119
|
+
"revise-sign": {
|
|
120
|
+
type: "boolean",
|
|
121
|
+
default: true,
|
|
122
|
+
description: "Disable GPG signing for git revise with --no-revise-sign",
|
|
123
|
+
},
|
|
124
|
+
|
|
112
125
|
"template": {
|
|
113
126
|
type: "boolean",
|
|
114
127
|
default: true,
|
|
115
|
-
description:
|
|
116
|
-
|
|
128
|
+
description: [
|
|
129
|
+
// force line break
|
|
130
|
+
"Use automatic Github PR template, e.g. .github/pull_request_template.md",
|
|
131
|
+
"Disable with --no-template",
|
|
132
|
+
].join("\n"),
|
|
117
133
|
},
|
|
118
134
|
|
|
119
135
|
"write-state-json": {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
|
|
4
|
+
import { Store } from "~/app/Store";
|
|
4
5
|
import * as Metadata from "~/core/Metadata";
|
|
5
6
|
import { cli } from "~/core/cli";
|
|
6
7
|
import { get_tmp_dir } from "~/core/get_tmp_dir";
|
|
@@ -106,6 +107,9 @@ GitReviseTodo.todo = function todo(args: CommitListArgs) {
|
|
|
106
107
|
};
|
|
107
108
|
|
|
108
109
|
GitReviseTodo.execute = async function grt_execute(args: ExecuteArgs) {
|
|
110
|
+
const argv = Store.getState().argv;
|
|
111
|
+
const actions = Store.getState().actions;
|
|
112
|
+
|
|
109
113
|
// replaced at build time with literal contents of `scripts/git-sequence-editor.sh`
|
|
110
114
|
const GIT_SEQUENCE_EDITOR_SCRIPT = process.env.GIT_SEQUENCE_EDITOR_SCRIPT;
|
|
111
115
|
invariant(GIT_SEQUENCE_EDITOR_SCRIPT, "GIT_SEQUENCE_EDITOR_SCRIPT must exist");
|
|
@@ -126,13 +130,31 @@ GitReviseTodo.execute = async function grt_execute(args: ExecuteArgs) {
|
|
|
126
130
|
`GIT_EDITOR="${tmp_git_sequence_editor_path}"`,
|
|
127
131
|
`GIT_REVISE_TODO="${tmp_path_git_revise_todo}"`,
|
|
128
132
|
`git`,
|
|
129
|
-
`revise --edit -i ${args.rebase_merge_base}`,
|
|
130
133
|
];
|
|
131
134
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
if (!argv["revise-sign"]) {
|
|
136
|
+
command.push(...["-c", "commit.gpgsign=false"]);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
command.push(`revise --edit -i ${args.rebase_merge_base}`);
|
|
140
|
+
|
|
141
|
+
try {
|
|
142
|
+
// `ignore` hides output which helps prevent scrollback clear
|
|
143
|
+
// `pipe` helps see failures when git revise fails
|
|
144
|
+
// https://github.com/magus/git-stack-cli/commit/f9f10e3ac3cd9a35ee75d3e0851a48391967a23f
|
|
145
|
+
await cli(command, { stdio: ["pipe", "pipe", "pipe"] });
|
|
146
|
+
} catch (err) {
|
|
147
|
+
if (err instanceof Error) {
|
|
148
|
+
actions.error(err.message);
|
|
149
|
+
if (err.message.includes("gpg failed to sign commit")) {
|
|
150
|
+
actions.error("\n\n");
|
|
151
|
+
actions.error("🚨 git revise failed to sign commit");
|
|
152
|
+
actions.error("💡 Try again with `--no-revise-sign`?");
|
|
153
|
+
actions.error("\n\n");
|
|
154
|
+
actions.exit(21);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
136
158
|
|
|
137
159
|
// cleanup tmp_git_sequence_editor_path
|
|
138
160
|
await safe_rm(tmp_git_sequence_editor_path);
|