git-stack-cli 1.0.6 → 1.1.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.
@@ -0,0 +1,572 @@
1
+ import { test, expect } from "bun:test";
2
+
3
+ import { GitReviseTodo } from "~/core/GitReviseTodo";
4
+
5
+ import type * as CommitMetadata from "~/core/CommitMetadata";
6
+
7
+ test("git-revise-todo from commit range with single new commit", () => {
8
+ const rebase_group_index = 1;
9
+ const commit_range = SINGLE_COMMIT_EXISTING_GROUP;
10
+
11
+ const git_revise_todo = GitReviseTodo({ rebase_group_index, commit_range });
12
+
13
+ expect(git_revise_todo).toBe(
14
+ [
15
+ "++ pick 3cb22661ecff",
16
+ "lemon color",
17
+ "",
18
+ "git-stack-id: E63ytp5dj",
19
+ "",
20
+ "++ pick d36d63499425",
21
+ "cantaloupe color",
22
+ "",
23
+ "git-stack-id: E63ytp5dj",
24
+ "",
25
+ "++ pick 4f98dd3e67d0",
26
+ "banana sweet",
27
+ "",
28
+ "git-stack-id: E63ytp5dj",
29
+ "",
30
+ "++ pick f143d03c723c",
31
+ "apple sweet",
32
+ "",
33
+ "git-stack-id: E63ytp5dj",
34
+ ].join("\n")
35
+ );
36
+ });
37
+
38
+ test("git-revise-todo from commit range with single new commit in new group", () => {
39
+ const rebase_group_index = 2;
40
+ const commit_range = SINGLE_COMMIT_NEW_GROUP;
41
+
42
+ const git_revise_todo = GitReviseTodo({ rebase_group_index, commit_range });
43
+
44
+ expect(git_revise_todo).toBe(
45
+ [
46
+ //force line break
47
+ "++ pick f143d03c723c",
48
+ "apple sweet",
49
+ "",
50
+ "git-stack-id: 6Ak-qn+5Z",
51
+ ].join("\n")
52
+ );
53
+ });
54
+
55
+ const SINGLE_COMMIT_EXISTING_GROUP: CommitMetadata.CommitRange = {
56
+ "invalid": false,
57
+ "group_list": [
58
+ {
59
+ "id": "AAWsYx1UU",
60
+ "title": "banana",
61
+ "pr": {
62
+ "baseRefName": "master",
63
+ "body":
64
+ "adsf\r\n\r\n#### git stack\n- ⏳ `2` https://github.com/magus/git-multi-diff-playground/pull/47\n- 👉 `1` https://github.com/magus/git-multi-diff-playground/pull/43",
65
+ "commits": [
66
+ {
67
+ "authoredDate": "2024-02-25T03:41:42Z",
68
+ "authors": [
69
+ {
70
+ "email": "noah@iamnoah.com",
71
+ "id": "MDQ6VXNlcjI5MDA4NA==",
72
+ "login": "magus",
73
+ "name": "magus",
74
+ },
75
+ ],
76
+ "committedDate": "2024-02-25T03:41:42Z",
77
+ "messageBody": "git-stack-id: AAWsYx1UU",
78
+ "messageHeadline": "banana color",
79
+ "oid": "35ff24f920c0778a8560e9a3ccdd1ca5ec16172b",
80
+ },
81
+ ],
82
+ "headRefName": "AAWsYx1UU",
83
+ "number": 43,
84
+ "state": "OPEN",
85
+ "title": "banana",
86
+ "url": "https://github.com/magus/git-multi-diff-playground/pull/43",
87
+ },
88
+ "base": "master",
89
+ "dirty": false,
90
+ "commits": [
91
+ {
92
+ "sha": "35ff24f920c0778a8560e9a3ccdd1ca5ec16172b",
93
+ "full_message": "banana color\n\ngit-stack-id: AAWsYx1UU",
94
+ "subject_line": "banana color",
95
+ "branch_id": "AAWsYx1UU",
96
+ },
97
+ ],
98
+ },
99
+ {
100
+ "id": "E63ytp5dj",
101
+ "title": "lemon color",
102
+ "pr": {
103
+ "baseRefName": "AAWsYx1UU",
104
+ "body":
105
+ "\r\n\r\n#### git stack\n- 👉 `3` https://github.com/magus/git-multi-diff-playground/pull/47\n- ⏳ `2` https://github.com/magus/git-multi-diff-playground/pull/43\n- ✅ `1`\n https://github.com/magus/git-multi-diff-playground/pull/42",
106
+ "commits": [
107
+ {
108
+ "authoredDate": "2024-02-25T03:41:46Z",
109
+ "authors": [
110
+ {
111
+ "email": "noah@iamnoah.com",
112
+ "id": "MDQ6VXNlcjI5MDA4NA==",
113
+ "login": "magus",
114
+ "name": "magus",
115
+ },
116
+ ],
117
+ "committedDate": "2024-02-25T03:41:46Z",
118
+ "messageBody": "git-stack-id: E63ytp5dj",
119
+ "messageHeadline": "lemon color",
120
+ "oid": "3cb22661ecff6c872e96ce9c40b31c824938cab7",
121
+ },
122
+ {
123
+ "authoredDate": "2024-02-25T03:41:46Z",
124
+ "authors": [
125
+ {
126
+ "email": "noah@iamnoah.com",
127
+ "id": "MDQ6VXNlcjI5MDA4NA==",
128
+ "login": "magus",
129
+ "name": "magus",
130
+ },
131
+ ],
132
+ "committedDate": "2024-02-25T03:41:46Z",
133
+ "messageBody": "git-stack-id: E63ytp5dj",
134
+ "messageHeadline": "cantaloupe color",
135
+ "oid": "d36d63499425bb46a1e62c2c9df1a4332b13004f",
136
+ },
137
+ {
138
+ "authoredDate": "2024-02-25T03:41:46Z",
139
+ "authors": [
140
+ {
141
+ "email": "noah@iamnoah.com",
142
+ "id": "MDQ6VXNlcjI5MDA4NA==",
143
+ "login": "magus",
144
+ "name": "magus",
145
+ },
146
+ ],
147
+ "committedDate": "2024-02-25T03:41:46Z",
148
+ "messageBody": "git-stack-id: E63ytp5dj",
149
+ "messageHeadline": "banana sweet",
150
+ "oid": "4f98dd3e67d03b79d7a12480c7d1c2fcbd186ac5",
151
+ },
152
+ ],
153
+ "headRefName": "E63ytp5dj",
154
+ "number": 47,
155
+ "state": "OPEN",
156
+ "title": "lemon color",
157
+ "url": "https://github.com/magus/git-multi-diff-playground/pull/47",
158
+ },
159
+ "base": "AAWsYx1UU",
160
+ "dirty": true,
161
+ "commits": [
162
+ {
163
+ "sha": "3cb22661ecff6c872e96ce9c40b31c824938cab7",
164
+ "full_message": "lemon color\n\ngit-stack-id: E63ytp5dj",
165
+ "subject_line": "lemon color",
166
+ "branch_id": "E63ytp5dj",
167
+ },
168
+ {
169
+ "sha": "d36d63499425bb46a1e62c2c9df1a4332b13004f",
170
+ "full_message": "cantaloupe color\n\ngit-stack-id: E63ytp5dj",
171
+ "subject_line": "cantaloupe color",
172
+ "branch_id": "E63ytp5dj",
173
+ },
174
+ {
175
+ "sha": "4f98dd3e67d03b79d7a12480c7d1c2fcbd186ac5",
176
+ "full_message": "banana sweet\n\ngit-stack-id: E63ytp5dj",
177
+ "subject_line": "banana sweet",
178
+ "branch_id": "E63ytp5dj",
179
+ },
180
+ {
181
+ "sha": "f143d03c723c9f5231a81c1e12098511611898cb",
182
+ "full_message": "apple sweet",
183
+ "subject_line": "apple sweet",
184
+ "branch_id": null,
185
+ },
186
+ ],
187
+ },
188
+ ],
189
+ "commit_list": [
190
+ {
191
+ "sha": "35ff24f920c0778a8560e9a3ccdd1ca5ec16172b",
192
+ "full_message": "banana color\n\ngit-stack-id: AAWsYx1UU",
193
+ "subject_line": "banana color",
194
+ "branch_id": "AAWsYx1UU",
195
+ },
196
+ {
197
+ "sha": "3cb22661ecff6c872e96ce9c40b31c824938cab7",
198
+ "full_message": "lemon color\n\ngit-stack-id: E63ytp5dj",
199
+ "subject_line": "lemon color",
200
+ "branch_id": "E63ytp5dj",
201
+ },
202
+ {
203
+ "sha": "d36d63499425bb46a1e62c2c9df1a4332b13004f",
204
+ "full_message": "cantaloupe color\n\ngit-stack-id: E63ytp5dj",
205
+ "subject_line": "cantaloupe color",
206
+ "branch_id": "E63ytp5dj",
207
+ },
208
+ {
209
+ "sha": "4f98dd3e67d03b79d7a12480c7d1c2fcbd186ac5",
210
+ "full_message": "banana sweet\n\ngit-stack-id: E63ytp5dj",
211
+ "subject_line": "banana sweet",
212
+ "branch_id": "E63ytp5dj",
213
+ },
214
+ {
215
+ "sha": "f143d03c723c9f5231a81c1e12098511611898cb",
216
+ "full_message": "apple sweet",
217
+ "subject_line": "apple sweet",
218
+ "branch_id": null,
219
+ },
220
+ ],
221
+ "pr_lookup": {
222
+ "AAWsYx1UU": {
223
+ "baseRefName": "master",
224
+ "body":
225
+ "adsf\r\n\r\n#### git stack\n- ⏳ `2` https://github.com/magus/git-multi-diff-playground/pull/47\n- 👉 `1` https://github.com/magus/git-multi-diff-playground/pull/43",
226
+ "commits": [
227
+ {
228
+ "authoredDate": "2024-02-25T03:41:42Z",
229
+ "authors": [
230
+ {
231
+ "email": "noah@iamnoah.com",
232
+ "id": "MDQ6VXNlcjI5MDA4NA==",
233
+ "login": "magus",
234
+ "name": "magus",
235
+ },
236
+ ],
237
+ "committedDate": "2024-02-25T03:41:42Z",
238
+ "messageBody": "git-stack-id: AAWsYx1UU",
239
+ "messageHeadline": "banana color",
240
+ "oid": "35ff24f920c0778a8560e9a3ccdd1ca5ec16172b",
241
+ },
242
+ ],
243
+ "headRefName": "AAWsYx1UU",
244
+ "number": 43,
245
+ "state": "OPEN",
246
+ "title": "banana",
247
+ "url": "https://github.com/magus/git-multi-diff-playground/pull/43",
248
+ },
249
+ "E63ytp5dj": {
250
+ "baseRefName": "AAWsYx1UU",
251
+ "body":
252
+ "\r\n\r\n#### git stack\n- 👉 `3` https://github.com/magus/git-multi-diff-playground/pull/47\n- ⏳ `2` https://github.com/magus/git-multi-diff-playground/pull/43\n- ✅ `1`\n https://github.com/magus/git-multi-diff-playground/pull/42",
253
+ "commits": [
254
+ {
255
+ "authoredDate": "2024-02-25T03:41:46Z",
256
+ "authors": [
257
+ {
258
+ "email": "noah@iamnoah.com",
259
+ "id": "MDQ6VXNlcjI5MDA4NA==",
260
+ "login": "magus",
261
+ "name": "magus",
262
+ },
263
+ ],
264
+ "committedDate": "2024-02-25T03:41:46Z",
265
+ "messageBody": "git-stack-id: E63ytp5dj",
266
+ "messageHeadline": "lemon color",
267
+ "oid": "3cb22661ecff6c872e96ce9c40b31c824938cab7",
268
+ },
269
+ {
270
+ "authoredDate": "2024-02-25T03:41:46Z",
271
+ "authors": [
272
+ {
273
+ "email": "noah@iamnoah.com",
274
+ "id": "MDQ6VXNlcjI5MDA4NA==",
275
+ "login": "magus",
276
+ "name": "magus",
277
+ },
278
+ ],
279
+ "committedDate": "2024-02-25T03:41:46Z",
280
+ "messageBody": "git-stack-id: E63ytp5dj",
281
+ "messageHeadline": "cantaloupe color",
282
+ "oid": "d36d63499425bb46a1e62c2c9df1a4332b13004f",
283
+ },
284
+ {
285
+ "authoredDate": "2024-02-25T03:41:46Z",
286
+ "authors": [
287
+ {
288
+ "email": "noah@iamnoah.com",
289
+ "id": "MDQ6VXNlcjI5MDA4NA==",
290
+ "login": "magus",
291
+ "name": "magus",
292
+ },
293
+ ],
294
+ "committedDate": "2024-02-25T03:41:46Z",
295
+ "messageBody": "git-stack-id: E63ytp5dj",
296
+ "messageHeadline": "banana sweet",
297
+ "oid": "4f98dd3e67d03b79d7a12480c7d1c2fcbd186ac5",
298
+ },
299
+ ],
300
+ "headRefName": "E63ytp5dj",
301
+ "number": 47,
302
+ "state": "OPEN",
303
+ "title": "lemon color",
304
+ "url": "https://github.com/magus/git-multi-diff-playground/pull/47",
305
+ },
306
+ },
307
+ "UNASSIGNED": "unassigned",
308
+ };
309
+
310
+ const SINGLE_COMMIT_NEW_GROUP: CommitMetadata.CommitRange = {
311
+ "invalid": false,
312
+ "group_list": [
313
+ {
314
+ "id": "AAWsYx1UU",
315
+ "title": "banana",
316
+ "pr": {
317
+ "baseRefName": "master",
318
+ "body":
319
+ "adsf\r\n\r\n#### git stack\n- ⏳ `2` https://github.com/magus/git-multi-diff-playground/pull/47\n- 👉 `1` https://github.com/magus/git-multi-diff-playground/pull/43",
320
+ "commits": [
321
+ {
322
+ "authoredDate": "2024-02-25T03:41:42Z",
323
+ "authors": [
324
+ {
325
+ "email": "noah@iamnoah.com",
326
+ "id": "MDQ6VXNlcjI5MDA4NA==",
327
+ "login": "magus",
328
+ "name": "magus",
329
+ },
330
+ ],
331
+ "committedDate": "2024-02-25T03:41:42Z",
332
+ "messageBody": "git-stack-id: AAWsYx1UU",
333
+ "messageHeadline": "banana color",
334
+ "oid": "35ff24f920c0778a8560e9a3ccdd1ca5ec16172b",
335
+ },
336
+ ],
337
+ "headRefName": "AAWsYx1UU",
338
+ "number": 43,
339
+ "state": "OPEN",
340
+ "title": "banana",
341
+ "url": "https://github.com/magus/git-multi-diff-playground/pull/43",
342
+ },
343
+ "base": "master",
344
+ "dirty": false,
345
+ "commits": [
346
+ {
347
+ "sha": "35ff24f920c0778a8560e9a3ccdd1ca5ec16172b",
348
+ "full_message": "banana color\n\ngit-stack-id: AAWsYx1UU",
349
+ "subject_line": "banana color",
350
+ "branch_id": "AAWsYx1UU",
351
+ },
352
+ ],
353
+ },
354
+ {
355
+ "id": "E63ytp5dj",
356
+ "title": "lemon color",
357
+ "pr": {
358
+ "baseRefName": "AAWsYx1UU",
359
+ "body":
360
+ "\r\n\r\n#### git stack\n- 👉 `3` https://github.com/magus/git-multi-diff-playground/pull/47\n- ⏳ `2` https://github.com/magus/git-multi-diff-playground/pull/43\n- ✅ `1`\n https://github.com/magus/git-multi-diff-playground/pull/42",
361
+ "commits": [
362
+ {
363
+ "authoredDate": "2024-02-25T03:41:46Z",
364
+ "authors": [
365
+ {
366
+ "email": "noah@iamnoah.com",
367
+ "id": "MDQ6VXNlcjI5MDA4NA==",
368
+ "login": "magus",
369
+ "name": "magus",
370
+ },
371
+ ],
372
+ "committedDate": "2024-02-25T03:41:46Z",
373
+ "messageBody": "git-stack-id: E63ytp5dj",
374
+ "messageHeadline": "lemon color",
375
+ "oid": "3cb22661ecff6c872e96ce9c40b31c824938cab7",
376
+ },
377
+ {
378
+ "authoredDate": "2024-02-25T03:41:46Z",
379
+ "authors": [
380
+ {
381
+ "email": "noah@iamnoah.com",
382
+ "id": "MDQ6VXNlcjI5MDA4NA==",
383
+ "login": "magus",
384
+ "name": "magus",
385
+ },
386
+ ],
387
+ "committedDate": "2024-02-25T03:41:46Z",
388
+ "messageBody": "git-stack-id: E63ytp5dj",
389
+ "messageHeadline": "cantaloupe color",
390
+ "oid": "d36d63499425bb46a1e62c2c9df1a4332b13004f",
391
+ },
392
+ {
393
+ "authoredDate": "2024-02-25T03:41:46Z",
394
+ "authors": [
395
+ {
396
+ "email": "noah@iamnoah.com",
397
+ "id": "MDQ6VXNlcjI5MDA4NA==",
398
+ "login": "magus",
399
+ "name": "magus",
400
+ },
401
+ ],
402
+ "committedDate": "2024-02-25T03:41:46Z",
403
+ "messageBody": "git-stack-id: E63ytp5dj",
404
+ "messageHeadline": "banana sweet",
405
+ "oid": "4f98dd3e67d03b79d7a12480c7d1c2fcbd186ac5",
406
+ },
407
+ ],
408
+ "headRefName": "E63ytp5dj",
409
+ "number": 47,
410
+ "state": "OPEN",
411
+ "title": "lemon color",
412
+ "url": "https://github.com/magus/git-multi-diff-playground/pull/47",
413
+ },
414
+ "base": "AAWsYx1UU",
415
+ "dirty": false,
416
+ "commits": [
417
+ {
418
+ "sha": "3cb22661ecff6c872e96ce9c40b31c824938cab7",
419
+ "full_message": "lemon color\n\ngit-stack-id: E63ytp5dj",
420
+ "subject_line": "lemon color",
421
+ "branch_id": "E63ytp5dj",
422
+ },
423
+ {
424
+ "sha": "d36d63499425bb46a1e62c2c9df1a4332b13004f",
425
+ "full_message": "cantaloupe color\n\ngit-stack-id: E63ytp5dj",
426
+ "subject_line": "cantaloupe color",
427
+ "branch_id": "E63ytp5dj",
428
+ },
429
+ {
430
+ "sha": "4f98dd3e67d03b79d7a12480c7d1c2fcbd186ac5",
431
+ "full_message": "banana sweet\n\ngit-stack-id: E63ytp5dj",
432
+ "subject_line": "banana sweet",
433
+ "branch_id": "E63ytp5dj",
434
+ },
435
+ ],
436
+ },
437
+ {
438
+ "id": "6Ak-qn+5Z",
439
+ "title": "new group",
440
+ "pr": null,
441
+ "base": "E63ytp5dj",
442
+ "dirty": true,
443
+ "commits": [
444
+ {
445
+ "sha": "f143d03c723c9f5231a81c1e12098511611898cb",
446
+ "full_message": "apple sweet",
447
+ "subject_line": "apple sweet",
448
+ "branch_id": null,
449
+ },
450
+ ],
451
+ },
452
+ ],
453
+ "commit_list": [
454
+ {
455
+ "sha": "35ff24f920c0778a8560e9a3ccdd1ca5ec16172b",
456
+ "full_message": "banana color\n\ngit-stack-id: AAWsYx1UU",
457
+ "subject_line": "banana color",
458
+ "branch_id": "AAWsYx1UU",
459
+ },
460
+ {
461
+ "sha": "3cb22661ecff6c872e96ce9c40b31c824938cab7",
462
+ "full_message": "lemon color\n\ngit-stack-id: E63ytp5dj",
463
+ "subject_line": "lemon color",
464
+ "branch_id": "E63ytp5dj",
465
+ },
466
+ {
467
+ "sha": "d36d63499425bb46a1e62c2c9df1a4332b13004f",
468
+ "full_message": "cantaloupe color\n\ngit-stack-id: E63ytp5dj",
469
+ "subject_line": "cantaloupe color",
470
+ "branch_id": "E63ytp5dj",
471
+ },
472
+ {
473
+ "sha": "4f98dd3e67d03b79d7a12480c7d1c2fcbd186ac5",
474
+ "full_message": "banana sweet\n\ngit-stack-id: E63ytp5dj",
475
+ "subject_line": "banana sweet",
476
+ "branch_id": "E63ytp5dj",
477
+ },
478
+ {
479
+ "sha": "f143d03c723c9f5231a81c1e12098511611898cb",
480
+ "full_message": "apple sweet",
481
+ "subject_line": "apple sweet",
482
+ "branch_id": null,
483
+ },
484
+ ],
485
+ "pr_lookup": {
486
+ "AAWsYx1UU": {
487
+ "baseRefName": "master",
488
+ "body":
489
+ "adsf\r\n\r\n#### git stack\n- ⏳ `2` https://github.com/magus/git-multi-diff-playground/pull/47\n- 👉 `1` https://github.com/magus/git-multi-diff-playground/pull/43",
490
+ "commits": [
491
+ {
492
+ "authoredDate": "2024-02-25T03:41:42Z",
493
+ "authors": [
494
+ {
495
+ "email": "noah@iamnoah.com",
496
+ "id": "MDQ6VXNlcjI5MDA4NA==",
497
+ "login": "magus",
498
+ "name": "magus",
499
+ },
500
+ ],
501
+ "committedDate": "2024-02-25T03:41:42Z",
502
+ "messageBody": "git-stack-id: AAWsYx1UU",
503
+ "messageHeadline": "banana color",
504
+ "oid": "35ff24f920c0778a8560e9a3ccdd1ca5ec16172b",
505
+ },
506
+ ],
507
+ "headRefName": "AAWsYx1UU",
508
+ "number": 43,
509
+ "state": "OPEN",
510
+ "title": "banana",
511
+ "url": "https://github.com/magus/git-multi-diff-playground/pull/43",
512
+ },
513
+ "E63ytp5dj": {
514
+ "baseRefName": "AAWsYx1UU",
515
+ "body":
516
+ "\r\n\r\n#### git stack\n- 👉 `3` https://github.com/magus/git-multi-diff-playground/pull/47\n- ⏳ `2` https://github.com/magus/git-multi-diff-playground/pull/43\n- ✅ `1`\n https://github.com/magus/git-multi-diff-playground/pull/42",
517
+ "commits": [
518
+ {
519
+ "authoredDate": "2024-02-25T03:41:46Z",
520
+ "authors": [
521
+ {
522
+ "email": "noah@iamnoah.com",
523
+ "id": "MDQ6VXNlcjI5MDA4NA==",
524
+ "login": "magus",
525
+ "name": "magus",
526
+ },
527
+ ],
528
+ "committedDate": "2024-02-25T03:41:46Z",
529
+ "messageBody": "git-stack-id: E63ytp5dj",
530
+ "messageHeadline": "lemon color",
531
+ "oid": "3cb22661ecff6c872e96ce9c40b31c824938cab7",
532
+ },
533
+ {
534
+ "authoredDate": "2024-02-25T03:41:46Z",
535
+ "authors": [
536
+ {
537
+ "email": "noah@iamnoah.com",
538
+ "id": "MDQ6VXNlcjI5MDA4NA==",
539
+ "login": "magus",
540
+ "name": "magus",
541
+ },
542
+ ],
543
+ "committedDate": "2024-02-25T03:41:46Z",
544
+ "messageBody": "git-stack-id: E63ytp5dj",
545
+ "messageHeadline": "cantaloupe color",
546
+ "oid": "d36d63499425bb46a1e62c2c9df1a4332b13004f",
547
+ },
548
+ {
549
+ "authoredDate": "2024-02-25T03:41:46Z",
550
+ "authors": [
551
+ {
552
+ "email": "noah@iamnoah.com",
553
+ "id": "MDQ6VXNlcjI5MDA4NA==",
554
+ "login": "magus",
555
+ "name": "magus",
556
+ },
557
+ ],
558
+ "committedDate": "2024-02-25T03:41:46Z",
559
+ "messageBody": "git-stack-id: E63ytp5dj",
560
+ "messageHeadline": "banana sweet",
561
+ "oid": "4f98dd3e67d03b79d7a12480c7d1c2fcbd186ac5",
562
+ },
563
+ ],
564
+ "headRefName": "E63ytp5dj",
565
+ "number": 47,
566
+ "state": "OPEN",
567
+ "title": "lemon color",
568
+ "url": "https://github.com/magus/git-multi-diff-playground/pull/47",
569
+ },
570
+ },
571
+ "UNASSIGNED": "unassigned",
572
+ };
@@ -0,0 +1,79 @@
1
+ import * as Metadata from "~/core/Metadata";
2
+
3
+ import type * as CommitMetadata from "~/core/CommitMetadata";
4
+
5
+ // https://git-revise.readthedocs.io/en/latest/man.html#interactive-mode
6
+ //
7
+ // # Interactive Revise Todos(4 commands)
8
+ // #
9
+ // # Commands:
10
+ // # p, pick <commit> = use commit
11
+ // # r, reword <commit> = use commit, but edit the commit message
12
+ // # s, squash <commit> = use commit, but meld into previous commit
13
+ // # f, fixup <commit> = like squash, but discard this commit's message
14
+ // # c, cut <commit> = interactively split commit into two smaller commits
15
+ // # i, index <commit> = leave commit changes staged, but uncommitted
16
+ // #
17
+ // # Each command block is prefixed by a '++' marker, followed by the command to
18
+ // # run, the commit hash and after a newline the complete commit message until
19
+ // # the next '++' marker or the end of the file.
20
+ // #
21
+ // # Commit messages will be reworded to match the provided message before the
22
+ // # command is performed.
23
+ // #
24
+ // # These blocks are executed from top to bottom. They can be re-ordered and
25
+ // # their commands can be changed, however the number of blocks must remain
26
+ // # identical. If present, index blocks must be at the bottom of the list,
27
+ // # i.e. they can not be followed by non-index blocks.
28
+ // #
29
+ // #
30
+ // # If you remove everything, the revising process will be aborted.
31
+
32
+ // calculate git-revise-todo from commit_range and rebase_group_index
33
+ //
34
+ // Example
35
+ // ----------------------------
36
+ // ++ pick d36d63499425
37
+ // cantaloupe color
38
+ //
39
+ // git-stack-id: E63ytp5dj
40
+ //
41
+ // ++ pick 4f98dd3e67d0
42
+ // banana sweet
43
+ //
44
+ // git-stack-id: E63ytp5dj
45
+ //
46
+ // ++ pick f143d03c723c
47
+ // apple sweet
48
+ //
49
+ export function GitReviseTodo(args: Args): string {
50
+ const entry_list = [];
51
+
52
+ const group_list = args.commit_range.group_list;
53
+
54
+ for (let i = args.rebase_group_index; i < group_list.length; i++) {
55
+ const group = group_list[i];
56
+
57
+ for (const commit of group.commits) {
58
+ // update git commit message with stack id
59
+ const message_with_id = Metadata.write(commit.full_message, group.id);
60
+
61
+ // get first 12 characters of commit sha
62
+ const sha = commit.sha.slice(0, 12);
63
+
64
+ // generate git revise entry
65
+ const entry_lines = [`++ pick ${sha}`, message_with_id];
66
+ const entry = entry_lines.join("\n");
67
+
68
+ entry_list.push(entry);
69
+ }
70
+ }
71
+
72
+ const todo = entry_list.join("\n\n");
73
+ return todo;
74
+ }
75
+
76
+ type Args = {
77
+ rebase_group_index: number;
78
+ commit_range: CommitMetadata.CommitRange;
79
+ };
@@ -3,5 +3,7 @@ declare namespace NodeJS {
3
3
  PATH: string;
4
4
  DEV?: "true" | "false";
5
5
  CLI_VERSION?: string;
6
+ GIT_STACK_STANDALONE?: "true" | "false";
7
+ GIT_SEQUENCE_EDITOR_SCRIPT?: string;
6
8
  }
7
9
  }