git-stack-cli 1.11.3 → 1.11.5

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.
@@ -30109,6 +30109,9 @@ echo "$GIT_REVISE_TODO" > "$git_revise_todo_path"
30109
30109
  `git`,
30110
30110
  `revise --edit -i ${args.rebase_merge_base}`,
30111
30111
  ];
30112
+ // ignore here is important to prevent scrollback clear
30113
+ // change to pipe to see output temporarily
30114
+ // https://github.com/magus/git-stack-cli/commit/f9f10e3ac3cd9a35ee75d3e0851a48391967a23f
30112
30115
  await cli(command, { stdio: ["ignore", "ignore", "ignore"] });
30113
30116
  };
30114
30117
 
@@ -30163,7 +30166,7 @@ function DetectInitialPR(props) {
30163
30166
  if (!has_existing_metadata) {
30164
30167
  // check for pr with matching branch name to initialize group
30165
30168
  const pr = await pr_status(branch_name);
30166
- if (pr) {
30169
+ if (pr && pr.state === "OPEN") {
30167
30170
  return patch({ status: "prompt", pr });
30168
30171
  }
30169
30172
  }
@@ -30738,13 +30741,11 @@ async function run$5() {
30738
30741
  const actions = state.actions;
30739
30742
  const argv = state.argv;
30740
30743
  const branch_name = state.branch_name;
30741
- const original_commit_range = cloneDeep$1(state.commit_range);
30742
30744
  const commit_map = state.commit_map;
30743
30745
  const master_branch = state.master_branch;
30744
30746
  const cwd = state.cwd;
30745
30747
  const repo_root = state.repo_root;
30746
30748
  invariant(branch_name, "branch_name must exist");
30747
- invariant(original_commit_range, "original_commit_range must exist");
30748
30749
  invariant(commit_map, "commit_map must exist");
30749
30750
  invariant(repo_root, "repo_root must exist");
30750
30751
  // always listen for SIGINT event and restore git state
@@ -30752,8 +30753,10 @@ async function run$5() {
30752
30753
  // get latest merge_base relative to local master
30753
30754
  const merge_base = (await cli(`git merge-base HEAD ${master_branch}`)).stdout;
30754
30755
  // immediately paint all commit to preserve selected commit ranges
30755
- original_commit_range.group_list.reverse();
30756
- for (const commit of original_commit_range.commit_list) {
30756
+ let commit_range = await range(commit_map);
30757
+ // reverse group list to ensure we create git revise in correct order
30758
+ commit_range.group_list.reverse();
30759
+ for (const commit of commit_range.commit_list) {
30757
30760
  const group_from_map = commit_map[commit.sha];
30758
30761
  commit.branch_id = group_from_map.id;
30759
30762
  commit.title = group_from_map.title;
@@ -30761,14 +30764,14 @@ async function run$5() {
30761
30764
  await GitReviseTodo.execute({
30762
30765
  rebase_group_index: 0,
30763
30766
  rebase_merge_base: merge_base,
30764
- commit_range: original_commit_range,
30767
+ commit_range,
30765
30768
  });
30766
30769
  let DEFAULT_PR_BODY = "";
30767
30770
  if (state.pr_template_body) {
30768
30771
  DEFAULT_PR_BODY = state.pr_template_body;
30769
30772
  }
30770
30773
  const temp_branch_name = `${branch_name}_${short_id()}`;
30771
- const commit_range = await range(commit_map);
30774
+ commit_range = await range(commit_map);
30772
30775
  // reverse commit list so that we can cherry-pick in order
30773
30776
  commit_range.group_list.reverse();
30774
30777
  let rebase_merge_base = merge_base;
@@ -37392,7 +37395,7 @@ async function command() {
37392
37395
  .wrap(123)
37393
37396
  // disallow unknown options
37394
37397
  .strict()
37395
- .version("1.11.3" )
37398
+ .version("1.11.5" )
37396
37399
  .showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`")
37397
37400
  .help("help", "Show usage via `git stack help`")
37398
37401
  .argv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-stack-cli",
3
- "version": "1.11.3",
3
+ "version": "1.11.5",
4
4
  "description": "",
5
5
  "author": "magus",
6
6
  "license": "MIT",
@@ -126,7 +126,8 @@ export function DetectInitialPR(props: Props) {
126
126
  if (!has_existing_metadata) {
127
127
  // check for pr with matching branch name to initialize group
128
128
  const pr = await github.pr_status(branch_name);
129
- if (pr) {
129
+
130
+ if (pr && pr.state === "OPEN") {
130
131
  return patch({ status: "prompt", pr });
131
132
  }
132
133
  }
@@ -3,7 +3,6 @@ import * as React from "react";
3
3
  import fs from "node:fs";
4
4
 
5
5
  import * as Ink from "ink-cjs";
6
- import cloneDeep from "lodash/cloneDeep";
7
6
 
8
7
  import { Await } from "~/app/Await";
9
8
  import { Brackets } from "~/app/Brackets";
@@ -33,14 +32,12 @@ async function run() {
33
32
  const actions = state.actions;
34
33
  const argv = state.argv;
35
34
  const branch_name = state.branch_name;
36
- const original_commit_range = cloneDeep(state.commit_range);
37
35
  const commit_map = state.commit_map;
38
36
  const master_branch = state.master_branch;
39
37
  const cwd = state.cwd;
40
38
  const repo_root = state.repo_root;
41
39
 
42
40
  invariant(branch_name, "branch_name must exist");
43
- invariant(original_commit_range, "original_commit_range must exist");
44
41
  invariant(commit_map, "commit_map must exist");
45
42
  invariant(repo_root, "repo_root must exist");
46
43
 
@@ -51,8 +48,12 @@ async function run() {
51
48
  const merge_base = (await cli(`git merge-base HEAD ${master_branch}`)).stdout;
52
49
 
53
50
  // immediately paint all commit to preserve selected commit ranges
54
- original_commit_range.group_list.reverse();
55
- for (const commit of original_commit_range.commit_list) {
51
+ let commit_range = await CommitMetadata.range(commit_map);
52
+
53
+ // reverse group list to ensure we create git revise in correct order
54
+ commit_range.group_list.reverse();
55
+
56
+ for (const commit of commit_range.commit_list) {
56
57
  const group_from_map = commit_map[commit.sha];
57
58
  commit.branch_id = group_from_map.id;
58
59
  commit.title = group_from_map.title;
@@ -61,7 +62,7 @@ async function run() {
61
62
  await GitReviseTodo.execute({
62
63
  rebase_group_index: 0,
63
64
  rebase_merge_base: merge_base,
64
- commit_range: original_commit_range,
65
+ commit_range,
65
66
  });
66
67
 
67
68
  let DEFAULT_PR_BODY = "";
@@ -71,7 +72,7 @@ async function run() {
71
72
 
72
73
  const temp_branch_name = `${branch_name}_${short_id()}`;
73
74
 
74
- const commit_range = await CommitMetadata.range(commit_map);
75
+ commit_range = await CommitMetadata.range(commit_map);
75
76
 
76
77
  // reverse commit list so that we can cherry-pick in order
77
78
  commit_range.group_list.reverse();
@@ -136,6 +136,9 @@ GitReviseTodo.execute = async function grt_execute(args: ExecuteArgs) {
136
136
  `revise --edit -i ${args.rebase_merge_base}`,
137
137
  ];
138
138
 
139
+ // ignore here is important to prevent scrollback clear
140
+ // change to pipe to see output temporarily
141
+ // https://github.com/magus/git-stack-cli/commit/f9f10e3ac3cd9a35ee75d3e0851a48391967a23f
139
142
  await cli(command, { stdio: ["ignore", "ignore", "ignore"] });
140
143
  };
141
144