git-stack-cli 1.2.5 → 1.2.7

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/README.md CHANGED
@@ -80,9 +80,11 @@ Managing even a few stacked diffs requires a relatively strong knowledge of `git
80
80
  git submodule update --init --recursive
81
81
  npm i
82
82
  npm run dev
83
+ npm unlink git-stack-cli
83
84
  npm link
84
85
 
85
86
  # navigate to project to test within
87
+ npm unlink git-stack-cli
86
88
  npm link git-stack-cli
87
89
 
88
90
  git stack --verbose
@@ -98,7 +100,7 @@ npm run build:standalone
98
100
 
99
101
  > [!IMPORTANT]
100
102
  >
101
- > **You must update the `version` in `package.json` and commit all changes first!**
103
+ > **You must update the `version` in `package.json` before running `npm run release`**
102
104
 
103
105
  ```bash
104
106
  npm run release
@@ -26205,7 +26205,6 @@ const BaseStore = createStore()(immer((set, get) => ({
26205
26205
  repo_root: null,
26206
26206
  master_branch: "master",
26207
26207
  head: null,
26208
- merge_base: null,
26209
26208
  branch_name: null,
26210
26209
  commit_range: null,
26211
26210
  commit_map: null,
@@ -27048,7 +27047,6 @@ async function gather_metadata$1() {
27048
27047
  state.repo_root = repo_root;
27049
27048
  state.master_branch = master_branch;
27050
27049
  state.head = head;
27051
- state.merge_base = merge_base;
27052
27050
  state.branch_name = branch_name;
27053
27051
  });
27054
27052
  }
@@ -27400,7 +27398,8 @@ async function range(commit_group_map) {
27400
27398
  return { invalid, group_list, commit_list, pr_lookup, UNASSIGNED };
27401
27399
  }
27402
27400
  async function get_commit_list() {
27403
- const log_result = await cli(`git log master..HEAD --oneline --format=%H --color=never`);
27401
+ const master_branch = Store.getState().master_branch;
27402
+ const log_result = await cli(`git log ${master_branch}..HEAD --oneline --format=%H --color=never`);
27404
27403
  if (!log_result.stdout) {
27405
27404
  return [];
27406
27405
  }
@@ -27551,9 +27550,11 @@ async function run$3() {
27551
27550
  process.once("SIGINT", handle_exit);
27552
27551
  const temp_branch_name = `${branch_name}_${short_id()}`;
27553
27552
  try {
27553
+ actions.debug(`commit_range=${JSON.stringify(commit_range, null, 2)}`);
27554
27554
  // must perform rebase from repo root for applying git patch
27555
27555
  process.chdir(repo_root);
27556
27556
  await cli(`pwd`);
27557
+ // update local master to match remote
27557
27558
  await cli(`git fetch --no-tags -v origin ${master_branch}:${master_branch}`);
27558
27559
  const master_sha = (await cli(`git rev-parse ${master_branch}`)).stdout;
27559
27560
  const rebase_merge_base = master_sha;
@@ -27832,13 +27833,12 @@ async function run$2(props) {
27832
27833
  const actions = state.actions;
27833
27834
  const argv = state.argv;
27834
27835
  const branch_name = state.branch_name;
27835
- const merge_base = state.merge_base;
27836
27836
  const commit_map = state.commit_map;
27837
+ const master_branch = state.master_branch;
27837
27838
  const cwd = state.cwd;
27838
27839
  const repo_root = state.repo_root;
27839
27840
  invariant(argv, "argv must exist");
27840
27841
  invariant(branch_name, "branch_name must exist");
27841
- invariant(merge_base, "merge_base must exist");
27842
27842
  invariant(commit_map, "commit_map must exist");
27843
27843
  invariant(cwd, "cwd must exist");
27844
27844
  invariant(repo_root, "repo_root must exist");
@@ -27848,6 +27848,8 @@ async function run$2(props) {
27848
27848
  const commit_range = await range(commit_map);
27849
27849
  // reverse commit list so that we can cherry-pick in order
27850
27850
  commit_range.group_list.reverse();
27851
+ // get latest merge_base relative to local master
27852
+ const merge_base = (await cli(`git merge-base HEAD ${master_branch}`)).stdout;
27851
27853
  let rebase_merge_base = merge_base;
27852
27854
  let rebase_group_index = 0;
27853
27855
  for (let i = 0; i < commit_range.group_list.length; i++) {
@@ -27863,8 +27865,8 @@ async function run$2(props) {
27863
27865
  }
27864
27866
  break;
27865
27867
  }
27866
- actions.debug(`rebase_merge_base=${rebase_merge_base}`);
27867
- actions.debug(`rebase_group_index=${rebase_group_index}`);
27868
+ actions.debug(`rebase_merge_base = ${rebase_merge_base}`);
27869
+ actions.debug(`rebase_group_index = ${rebase_group_index}`);
27868
27870
  actions.debug(`commit_range=${JSON.stringify(commit_range, null, 2)}`);
27869
27871
  try {
27870
27872
  // must perform rebase from repo root for applying git patch
@@ -34334,7 +34336,7 @@ async function command() {
34334
34336
  .wrap(123)
34335
34337
  // disallow unknown options
34336
34338
  .strict()
34337
- .version("1.2.5" )
34339
+ .version("1.2.7" )
34338
34340
  .showHidden("show-hidden", "Show hidden options via `git stack help --show-hidden`")
34339
34341
  .help("help", "Show usage via `git stack help`").argv);
34340
34342
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-stack-cli",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "",
5
5
  "author": "magus",
6
6
  "license": "MIT",
@@ -117,7 +117,6 @@ async function gather_metadata() {
117
117
  state.repo_root = repo_root;
118
118
  state.master_branch = master_branch;
119
119
  state.head = head;
120
- state.merge_base = merge_base;
121
120
  state.branch_name = branch_name;
122
121
  });
123
122
  } catch (err) {
@@ -47,16 +47,18 @@ async function run() {
47
47
  const temp_branch_name = `${branch_name}_${short_id()}`;
48
48
 
49
49
  try {
50
+ actions.debug(`commit_range=${JSON.stringify(commit_range, null, 2)}`);
51
+
50
52
  // must perform rebase from repo root for applying git patch
51
53
  process.chdir(repo_root);
52
54
  await cli(`pwd`);
53
55
 
56
+ // update local master to match remote
54
57
  await cli(
55
58
  `git fetch --no-tags -v origin ${master_branch}:${master_branch}`
56
59
  );
57
60
 
58
61
  const master_sha = (await cli(`git rev-parse ${master_branch}`)).stdout;
59
-
60
62
  const rebase_merge_base = master_sha;
61
63
 
62
64
  // create temporary branch based on merge base
@@ -38,14 +38,13 @@ async function run(props: Props) {
38
38
  const actions = state.actions;
39
39
  const argv = state.argv;
40
40
  const branch_name = state.branch_name;
41
- const merge_base = state.merge_base;
42
41
  const commit_map = state.commit_map;
42
+ const master_branch = state.master_branch;
43
43
  const cwd = state.cwd;
44
44
  const repo_root = state.repo_root;
45
45
 
46
46
  invariant(argv, "argv must exist");
47
47
  invariant(branch_name, "branch_name must exist");
48
- invariant(merge_base, "merge_base must exist");
49
48
  invariant(commit_map, "commit_map must exist");
50
49
  invariant(cwd, "cwd must exist");
51
50
  invariant(repo_root, "repo_root must exist");
@@ -60,6 +59,9 @@ async function run(props: Props) {
60
59
  // reverse commit list so that we can cherry-pick in order
61
60
  commit_range.group_list.reverse();
62
61
 
62
+ // get latest merge_base relative to local master
63
+ const merge_base = (await cli(`git merge-base HEAD ${master_branch}`)).stdout;
64
+
63
65
  let rebase_merge_base = merge_base;
64
66
  let rebase_group_index = 0;
65
67
 
@@ -80,8 +82,8 @@ async function run(props: Props) {
80
82
  break;
81
83
  }
82
84
 
83
- actions.debug(`rebase_merge_base=${rebase_merge_base}`);
84
- actions.debug(`rebase_group_index=${rebase_group_index}`);
85
+ actions.debug(`rebase_merge_base = ${rebase_merge_base}`);
86
+ actions.debug(`rebase_group_index = ${rebase_group_index}`);
85
87
  actions.debug(`commit_range=${JSON.stringify(commit_range, null, 2)}`);
86
88
 
87
89
  try {
package/src/app/Store.tsx CHANGED
@@ -34,7 +34,6 @@ export type State = {
34
34
  repo_root: null | string;
35
35
  master_branch: string;
36
36
  head: null | string;
37
- merge_base: null | string;
38
37
  branch_name: null | string;
39
38
  commit_range: null | CommitMetadata.CommitRange;
40
39
  commit_map: null | CommitMap;
@@ -95,7 +94,6 @@ const BaseStore = createStore<State>()(
95
94
  repo_root: null,
96
95
  master_branch: "master",
97
96
  head: null,
98
- merge_base: null,
99
97
  branch_name: null,
100
98
  commit_range: null,
101
99
  commit_map: null,
@@ -165,8 +165,9 @@ export async function range(commit_group_map?: CommitGroupMap) {
165
165
  }
166
166
 
167
167
  async function get_commit_list() {
168
+ const master_branch = Store.getState().master_branch;
168
169
  const log_result = await cli(
169
- `git log master..HEAD --oneline --format=%H --color=never`
170
+ `git log ${master_branch}..HEAD --oneline --format=%H --color=never`
170
171
  );
171
172
 
172
173
  if (!log_result.stdout) {