git-stack-cli 0.8.1 → 0.8.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.
|
@@ -41,6 +41,13 @@ async function gather_metadata() {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
const branch_name = (await cli("git rev-parse --abbrev-ref HEAD")).stdout;
|
|
44
|
+
// handle detahed head state
|
|
45
|
+
if (branch_name === "HEAD") {
|
|
46
|
+
actions.newline();
|
|
47
|
+
actions.error("Must run within a branch.");
|
|
48
|
+
actions.exit(0);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
44
51
|
// handle when there are no detected changes
|
|
45
52
|
if (branch_name === master_branch) {
|
|
46
53
|
actions.newline();
|
|
@@ -53,9 +53,13 @@ async function run() {
|
|
|
53
53
|
commit_message: React.createElement(Brackets, null, commit.message),
|
|
54
54
|
} }));
|
|
55
55
|
}
|
|
56
|
+
// ensure clean base to avoid conflicts when applying patch
|
|
57
|
+
await cli(`git clean -fd`);
|
|
58
|
+
// create, apply and cleanup patch
|
|
56
59
|
await cli(`git format-patch -1 ${commit.sha} --stdout > ${PATCH_FILE}`);
|
|
57
60
|
await cli(`git apply ${PATCH_FILE}`);
|
|
58
61
|
await cli(`rm ${PATCH_FILE}`);
|
|
62
|
+
// add all changes to stage
|
|
59
63
|
await cli(`git add --all`);
|
|
60
64
|
let new_message;
|
|
61
65
|
if (commit.branch_id) {
|
|
@@ -108,9 +112,10 @@ async function run() {
|
|
|
108
112
|
const spawn_options = { ignoreExitCode: true };
|
|
109
113
|
// always clean up any patch files
|
|
110
114
|
cli.sync(`rm ${PATCH_FILE}`, spawn_options);
|
|
111
|
-
// always hard reset to allow subsequent checkout
|
|
115
|
+
// always hard reset and clean to allow subsequent checkout
|
|
112
116
|
// if there are files checkout will fail and cascade fail subsequent commands
|
|
113
117
|
cli.sync(`git reset --hard`, spawn_options);
|
|
118
|
+
cli.sync(`git clean -df`, spawn_options);
|
|
114
119
|
// always put self back in original branch
|
|
115
120
|
cli.sync(`git checkout ${branch_name}`, spawn_options);
|
|
116
121
|
// ...and cleanup temporary branch
|
|
@@ -135,4 +140,4 @@ async function run() {
|
|
|
135
140
|
actions.exit(6);
|
|
136
141
|
}
|
|
137
142
|
}
|
|
138
|
-
const PATCH_FILE = "
|
|
143
|
+
const PATCH_FILE = "git-stack-cli-patch.patch";
|
package/dist/app/ManualRebase.js
CHANGED
|
@@ -54,12 +54,19 @@ async function run(props) {
|
|
|
54
54
|
for (let i = rebase_group_index; i < commit_range.group_list.length; i++) {
|
|
55
55
|
const group = commit_range.group_list[i];
|
|
56
56
|
invariant(group.base, "group.base must exist");
|
|
57
|
+
actions.output(React.createElement(FormatText, { wrapper: React.createElement(Ink.Text, { color: colors.yellow, wrap: "truncate-end" }), message: "Rebasing {group}\u2026", values: {
|
|
58
|
+
group: (React.createElement(Brackets, null, group.pr?.title || group.title || group.id)),
|
|
59
|
+
} }));
|
|
57
60
|
const selected_url = get_group_url(group);
|
|
58
61
|
// cherry-pick and amend commits one by one
|
|
59
62
|
for (const commit of group.commits) {
|
|
63
|
+
// ensure clean base to avoid conflicts when applying patch
|
|
64
|
+
await cli(`git clean -fd`);
|
|
65
|
+
// create, apply and cleanup patch
|
|
60
66
|
await cli(`git format-patch -1 ${commit.sha} --stdout > ${PATCH_FILE}`);
|
|
61
67
|
await cli(`git apply ${PATCH_FILE}`);
|
|
62
68
|
await cli(`rm ${PATCH_FILE}`);
|
|
69
|
+
// add all changes to stage
|
|
63
70
|
await cli(`git add --all`);
|
|
64
71
|
const new_message = await Metadata.write(commit.message, group.id);
|
|
65
72
|
const git_commit_comand = [`git commit -m "${new_message}"`];
|
|
@@ -167,9 +174,10 @@ async function run(props) {
|
|
|
167
174
|
const spawn_options = { ignoreExitCode: true };
|
|
168
175
|
// always clean up any patch files
|
|
169
176
|
cli.sync(`rm ${PATCH_FILE}`, spawn_options);
|
|
170
|
-
// always hard reset to allow subsequent checkout
|
|
177
|
+
// always hard reset and clean to allow subsequent checkout
|
|
171
178
|
// if there are files checkout will fail and cascade fail subsequent commands
|
|
172
179
|
cli.sync(`git reset --hard`, spawn_options);
|
|
180
|
+
cli.sync(`git clean -df`, spawn_options);
|
|
173
181
|
// always put self back in original branch
|
|
174
182
|
cli.sync(`git checkout ${branch_name}`, spawn_options);
|
|
175
183
|
// ...and cleanup temporary branch
|
|
@@ -195,4 +203,4 @@ async function run(props) {
|
|
|
195
203
|
}
|
|
196
204
|
}
|
|
197
205
|
const get_group_url = (group) => group.pr?.url || group.id;
|
|
198
|
-
const PATCH_FILE = "
|
|
206
|
+
const PATCH_FILE = "git-stack-cli-patch.patch";
|
package/dist/app/MultiSelect.js
CHANGED
|
@@ -94,7 +94,7 @@ export function MultiSelect(props) {
|
|
|
94
94
|
const active = i === index;
|
|
95
95
|
const selected = selected_set.has(i);
|
|
96
96
|
const disabled = item.disabled || false;
|
|
97
|
-
return (React.createElement(ItemRow, { key:
|
|
97
|
+
return (React.createElement(ItemRow, { key: i, label: item.label, active: active, selected: selected, disabled: disabled, maxWidth: props.maxWidth }));
|
|
98
98
|
})));
|
|
99
99
|
}
|
|
100
100
|
function ItemRow(props) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-stack-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "magus",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,9 +19,11 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsc",
|
|
21
21
|
"dev": "tsc --watch",
|
|
22
|
-
"lint": "eslint .
|
|
23
|
-
"
|
|
24
|
-
"
|
|
22
|
+
"lint:check": "eslint .",
|
|
23
|
+
"lint": "npm run lint:check -- --fix",
|
|
24
|
+
"prettier:check": "prettier ./src --check",
|
|
25
|
+
"prettier": "npm run prettier:check -- --write",
|
|
26
|
+
"test": "npm run prettier:check && npm run lint:check && npm run build",
|
|
25
27
|
"prepublishOnly": "npm test"
|
|
26
28
|
},
|
|
27
29
|
"dependencies": {
|