git-stack-cli 2.2.1 → 2.2.3
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
CHANGED
|
@@ -37813,7 +37813,7 @@ function Url(props) {
|
|
|
37813
37813
|
import fs7 from "node:fs";
|
|
37814
37814
|
import path4 from "node:path";
|
|
37815
37815
|
function is_command_available(command) {
|
|
37816
|
-
const PATH =
|
|
37816
|
+
const PATH = process.env["PATH"];
|
|
37817
37817
|
invariant(PATH, "PATH env must exist");
|
|
37818
37818
|
const path_list = PATH.split(path4.delimiter);
|
|
37819
37819
|
for (const dir of path_list) {
|
|
@@ -38115,10 +38115,11 @@ async function pr_status(branch) {
|
|
|
38115
38115
|
}
|
|
38116
38116
|
async function pr_create(args) {
|
|
38117
38117
|
const title = safe_quote(args.title);
|
|
38118
|
+
const base = args.base.replace(/^origin\//, "");
|
|
38118
38119
|
let command_parts = [
|
|
38119
38120
|
"gh pr create",
|
|
38120
38121
|
`--head refs/heads/${args.branch}`,
|
|
38121
|
-
`--base ${
|
|
38122
|
+
`--base ${base}`,
|
|
38122
38123
|
`--title="${title}"`,
|
|
38123
38124
|
`--body="${args.body}"`
|
|
38124
38125
|
];
|
|
@@ -38133,7 +38134,8 @@ async function pr_create(args) {
|
|
|
38133
38134
|
return cli_result.stdout;
|
|
38134
38135
|
}
|
|
38135
38136
|
async function pr_edit(args) {
|
|
38136
|
-
const
|
|
38137
|
+
const base = args.base.replace(/^origin\//, "");
|
|
38138
|
+
const command_parts = [`gh pr edit ${args.branch} --base ${base}`];
|
|
38137
38139
|
let body_file;
|
|
38138
38140
|
if (args.body) {
|
|
38139
38141
|
body_file = await write_body_file(args);
|
|
@@ -38201,7 +38203,8 @@ function handle_error(output) {
|
|
|
38201
38203
|
}
|
|
38202
38204
|
async function write_body_file(args) {
|
|
38203
38205
|
invariant(args.body, "args.body must exist");
|
|
38204
|
-
|
|
38206
|
+
const base = args.base.replace(/^origin\//, "");
|
|
38207
|
+
let tmp_filename = safe_filename(`git-stack-body-${base}`);
|
|
38205
38208
|
const temp_path = path6.join(await get_tmp_dir(), tmp_filename);
|
|
38206
38209
|
await safe_rm(temp_path);
|
|
38207
38210
|
await fs9.writeFile(temp_path, args.body);
|
|
@@ -38289,7 +38292,8 @@ async function range(commit_group_map) {
|
|
|
38289
38292
|
group_list.push(group);
|
|
38290
38293
|
}
|
|
38291
38294
|
if (i2 === 0) {
|
|
38292
|
-
|
|
38295
|
+
const master_branch_name = master_branch.replace(/^origin\//, "");
|
|
38296
|
+
group.base = master_branch_name;
|
|
38293
38297
|
} else {
|
|
38294
38298
|
const last_group = group_value_list[i2 - 1];
|
|
38295
38299
|
if (group.id === UNASSIGNED) {
|
|
@@ -45642,7 +45646,7 @@ var yargs_default = Yargs;
|
|
|
45642
45646
|
|
|
45643
45647
|
// src/command.ts
|
|
45644
45648
|
async function command2() {
|
|
45645
|
-
return yargs_default(hideBin(process.argv)).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.2.
|
|
45649
|
+
return yargs_default(hideBin(process.argv)).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.2.3").showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`").help("help", "Show usage via `git stack help`").argv;
|
|
45646
45650
|
}
|
|
45647
45651
|
var GlobalOptions = {
|
|
45648
45652
|
verbose: {
|
package/package.json
CHANGED
|
@@ -132,7 +132,8 @@ export async function range(commit_group_map?: CommitGroupMap) {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
if (i === 0) {
|
|
135
|
-
|
|
135
|
+
const master_branch_name = master_branch.replace(/^origin\//, "");
|
|
136
|
+
group.base = master_branch_name;
|
|
136
137
|
} else {
|
|
137
138
|
const last_group = group_value_list[i - 1];
|
|
138
139
|
// console.debug(" ", "last_group", last_group.pr?.title.substring(0, 40));
|
package/src/core/github.tsx
CHANGED
|
@@ -125,14 +125,17 @@ export async function pr_create(args: CreatePullRequestArgs) {
|
|
|
125
125
|
|
|
126
126
|
// explicit refs/heads head branch to avoid creation failing
|
|
127
127
|
//
|
|
128
|
-
// ❯ gh pr create --head
|
|
128
|
+
// ❯ gh pr create --head refs/heads/gs-ED2etrzv2 --base gs-6LAx-On45 --title="2024-01-05 test" --body=""
|
|
129
129
|
// pull request create failed: GraphQL: Head sha can't be blank, Base sha can't be blank, No commits between gs-6LAx-On45 and origin/gs-ED2etrzv2, Head ref must be a branch (createPullRequest)
|
|
130
130
|
//
|
|
131
131
|
// https://github.com/cli/cli/issues/5465
|
|
132
|
+
|
|
133
|
+
const base = args.base.replace(/^origin\//, "");
|
|
134
|
+
|
|
132
135
|
let command_parts = [
|
|
133
136
|
"gh pr create",
|
|
134
137
|
`--head refs/heads/${args.branch}`,
|
|
135
|
-
`--base ${
|
|
138
|
+
`--base ${base}`,
|
|
136
139
|
`--title="${title}"`,
|
|
137
140
|
`--body="${args.body}"`,
|
|
138
141
|
];
|
|
@@ -158,7 +161,8 @@ type EditPullRequestArgs = {
|
|
|
158
161
|
};
|
|
159
162
|
|
|
160
163
|
export async function pr_edit(args: EditPullRequestArgs) {
|
|
161
|
-
const
|
|
164
|
+
const base = args.base.replace(/^origin\//, "");
|
|
165
|
+
const command_parts = [`gh pr edit ${args.branch} --base ${base}`];
|
|
162
166
|
|
|
163
167
|
let body_file: string | undefined;
|
|
164
168
|
|
|
@@ -269,7 +273,8 @@ async function write_body_file(args: EditPullRequestArgs) {
|
|
|
269
273
|
// ensure unique filename is safe for filesystem
|
|
270
274
|
// base (group id) might contain slashes, e.g. dev/magus/gs-3cmrMBSUj
|
|
271
275
|
// the flashes would mess up the filesystem path to this file
|
|
272
|
-
|
|
276
|
+
const base = args.base.replace(/^origin\//, "");
|
|
277
|
+
let tmp_filename = safe_filename(`git-stack-body-${base}`);
|
|
273
278
|
|
|
274
279
|
const temp_path = path.join(await get_tmp_dir(), tmp_filename);
|
|
275
280
|
|