ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / extensions / git / src / test / git.test.ts 721 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
import 'mocha' ;
import { GitStatusParser, parseGitCommits, parseGitmodules, parseLsTree, parseLsFiles, parseGitRemotes, parseCoAuthors } from '../git' ;
import * as assert from 'assert' ;
import { splitInChunks } from '../util' ;
suite ( 'git' , ( ) => {
suite ( 'GitStatusParser' , ( ) => {
test ( 'empty parser' , ( )
parser
assert parser status
parser
parser
assert parser status
parser
parser
assert parser status
path rename x y
parser
parser
parser
parser
assert parser status
path rename x y
path rename x y
path rename x y
parser
parser
parser
parser
parser
parser
parser
parser
parser
assert parser status
path rename x y
path rename x y
path rename x y
parser
parser
assert parser status
path rename x y
path rename x y
path rename x y
parser
parser
parser
assert parser status
path rename x y
path rename x y
path rename x y
parser
parser
parser
assert parser status
path rename x y
path rename x y
path rename x y
parser
parser
parser
assert parser status
path rename x y
path rename x y
path rename x y
parser
parser
assert parser status
path rename x y
path rename x y
path rename x y
parser
parser
parser
assert parser status
path rename x y
path rename x y
path rename x y
parser
parser
parser
parser
assert parser status
path rename x y
path rename x y
path rename x y
assert
sample
assert sample
name path url
sample
assert sample
name path url
name path url
name path url
name path url
sample
assert sample
name path url
sample
assert sample
name path url
assert
sample
assert sample
name fetchUrl pushUrl isReadOnly
sample
assert sample
name fetchUrl pushUrl isReadOnly
sample
assert sample
name fetchUrl pushUrl isReadOnly
name fetchUrl pushUrl isReadOnly
sample
assert sample
name fetchUrl pushUrl isReadOnly
name fetchUrl pushUrl isReadOnly
sample
assert sample
assert
hash
message
parents
authorDate
authorName
authorEmail
commitDate
refNames
shortStat
coAuthors
assert
hash
message
parents
authorDate
authorName
authorEmail
commitDate
refNames
shortStat
coAuthors
assert
hash
message
parents
authorDate
authorName
authorEmail
commitDate
refNames
shortStat
coAuthors
assert
hash
message
parents
authorDate
authorName
authorEmail
commitDate
refNames
shortStat
deletions
files
insertions
coAuthors
assert
hash
message
parents
authorDate
authorName
authorEmail
commitDate
refNames
shortStat
deletions
files
insertions
coAuthors
assert
hash
message
parents
authorDate
authorName
authorEmail
commitDate
refNames
shortStat
deletions
files
insertions
coAuthors
assert
hash
message
parents
authorDate
authorName
authorEmail
commitDate
refNames
shortStat
coAuthors
hash
message
parents
authorDate
authorName
authorEmail
commitDate
refNames
shortStat
coAuthors
assert
hash
message
parents
authorDate
authorName
authorEmail
commitDate
refNames
shortStat
deletions
files
insertions
coAuthors
hash
message
parents
authorDate
authorName
authorEmail
commitDate
refNames
shortStat
deletions
files
insertions
coAuthors
input
output input
assert output
mode type object size file
mode type object size file
mode type object size file
mode type object size file
mode type object size file
mode type object size file
mode type object size file
mode type object size file
mode type object size file
mode type object size file
mode type object size file
input
output input
assert output
mode object stage file
mode object stage file
mode object stage file
mode object stage file
mode object stage file
mode object stage file
mode object stage file
mode object stage file
mode object stage file
mode object stage file
mode object stage file
assert
assert
name email
assert
name email
name email
assert
name email
assert
name email
assert
name email
assert
assert
assert
assert
assert
assert
assert
assert
assert
assert
assert
assert
assert
assert
=>
{
const
=
new
GitStatusParser
(
)
;
.
deepStrictEqual
(
.
,
[
]
)
;
}
)
;
test
(
'empty parser 2'
,
(
)
=>
{
const
=
new
GitStatusParser
(
)
;
.
update
(
''
)
;
.
deepStrictEqual
(
.
,
[
]
)
;
}
)
;
test
(
'simple'
,
(
)
=>
{
const
=
new
GitStatusParser
(
)
;
.
update
(
'?? file.txt\0'
)
;
.
deepStrictEqual
(
.
,
[
{
:
'file.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
]
)
;
}
)
;
test
(
'simple 2'
,
(
)
=>
{
const
=
new
GitStatusParser
(
)
;
.
update
(
'?? file.txt\0'
)
;
.
update
(
'?? file2.txt\0'
)
;
.
update
(
'?? file3.txt\0'
)
;
.
deepStrictEqual
(
.
,
[
{
:
'file.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file2.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file3.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
]
)
;
}
)
;
test
(
'empty lines'
,
(
)
=>
{
const
=
new
GitStatusParser
(
)
;
.
update
(
''
)
;
.
update
(
'?? file.txt\0'
)
;
.
update
(
''
)
;
.
update
(
''
)
;
.
update
(
'?? file2.txt\0'
)
;
.
update
(
''
)
;
.
update
(
'?? file3.txt\0'
)
;
.
update
(
''
)
;
.
deepStrictEqual
(
.
,
[
{
:
'file.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file2.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file3.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
]
)
;
}
)
;
test
(
'combined'
,
(
)
=>
{
const
=
new
GitStatusParser
(
)
;
.
update
(
'?? file.txt\0?? file2.txt\0?? file3.txt\0'
)
;
.
deepStrictEqual
(
.
,
[
{
:
'file.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file2.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file3.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
]
)
;
}
)
;
test
(
'split 1'
,
(
)
=>
{
const
=
new
GitStatusParser
(
)
;
.
update
(
'?? file.txt\0?? file2'
)
;
.
update
(
'.txt\0?? file3.txt\0'
)
;
.
deepStrictEqual
(
.
,
[
{
:
'file.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file2.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file3.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
]
)
;
}
)
;
test
(
'split 2'
,
(
)
=>
{
const
=
new
GitStatusParser
(
)
;
.
update
(
'?? file.txt'
)
;
.
update
(
'\0?? file2.txt\0?? file3.txt\0'
)
;
.
deepStrictEqual
(
.
,
[
{
:
'file.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file2.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file3.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
]
)
;
}
)
;
test
(
'split 3'
,
(
)
=>
{
const
=
new
GitStatusParser
(
)
;
.
update
(
'?? file.txt\0?? file2.txt\0?? file3.txt'
)
;
.
update
(
'\0'
)
;
.
deepStrictEqual
(
.
,
[
{
:
'file.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file2.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file3.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
]
)
;
}
)
;
test
(
'rename'
,
(
)
=>
{
const
=
new
GitStatusParser
(
)
;
.
update
(
'R newfile.txt\0file.txt\0?? file2.txt\0?? file3.txt\0'
)
;
.
deepStrictEqual
(
.
,
[
{
:
'file.txt'
,
:
'newfile.txt'
,
:
'R'
,
:
' '
}
,
{
:
'file2.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file3.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
]
)
;
}
)
;
test
(
'rename split'
,
(
)
=>
{
const
=
new
GitStatusParser
(
)
;
.
update
(
'R newfile.txt\0fil'
)
;
.
update
(
'e.txt\0?? file2.txt\0?? file3.txt\0'
)
;
.
deepStrictEqual
(
.
,
[
{
:
'file.txt'
,
:
'newfile.txt'
,
:
'R'
,
:
' '
}
,
{
:
'file2.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file3.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
]
)
;
}
)
;
test
(
'rename split 3'
,
(
)
=>
{
const
=
new
GitStatusParser
(
)
;
.
update
(
'?? file2.txt\0R new'
)
;
.
update
(
'file.txt\0fil'
)
;
.
update
(
'e.txt\0?? file3.txt\0'
)
;
.
deepStrictEqual
(
.
,
[
{
:
'file2.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
,
{
:
'file.txt'
,
:
'newfile.txt'
,
:
'R'
,
:
' '
}
,
{
:
'file3.txt'
,
:
undefined
,
:
'?'
,
:
'?'
}
]
)
;
}
)
;
}
)
;
suite
(
'parseGitmodules'
,
(
)
=>
{
test
(
'empty'
,
(
)
=>
{
.
deepStrictEqual
(
parseGitmodules
(
''
)
,
[
]
)
;
}
)
;
test
(
'sample'
,
(
)
=>
{
const
=
` [submodule "deps/spdlog"]
path = deps/spdlog
url = https://github.com/gabime/spdlog.git
`
;
.
deepStrictEqual
(
parseGitmodules
(
)
,
[
{
:
'deps/spdlog'
,
:
'deps/spdlog'
,
:
'https://github.com/gabime/spdlog.git'
}
]
)
;
}
)
;
test
(
'big'
,
(
)
=>
{
const
=
` [submodule "deps/spdlog"]
path = deps/spdlog
url = https://github.com/gabime/spdlog.git
[submodule "deps/spdlog2"]
path = deps/spdlog2
url = https://github.com/gabime/spdlog.git
[submodule "deps/spdlog3"]
path = deps/spdlog3
url = https://github.com/gabime/spdlog.git
[submodule "deps/spdlog4"]
path = deps/spdlog4
url = https://github.com/gabime/spdlog4.git
`
;
.
deepStrictEqual
(
parseGitmodules
(
)
,
[
{
:
'deps/spdlog'
,
:
'deps/spdlog'
,
:
'https://github.com/gabime/spdlog.git'
}
,
{
:
'deps/spdlog2'
,
:
'deps/spdlog2'
,
:
'https://github.com/gabime/spdlog.git'
}
,
{
:
'deps/spdlog3'
,
:
'deps/spdlog3'
,
:
'https://github.com/gabime/spdlog.git'
}
,
{
:
'deps/spdlog4'
,
:
'deps/spdlog4'
,
:
'https://github.com/gabime/spdlog4.git'
}
]
)
;
}
)
;
test
(
'whitespace #74844'
,
(
)
=>
{
const
=
` [submodule "deps/spdlog"]
path = deps/spdlog
url = https://github.com/gabime/spdlog.git
`
;
.
deepStrictEqual
(
parseGitmodules
(
)
,
[
{
:
'deps/spdlog'
,
:
'deps/spdlog'
,
:
'https://github.com/gabime/spdlog.git'
}
]
)
;
}
)
;
test
(
'whitespace again #108371'
,
(
)
=>
{
const
=
` [submodule "deps/spdlog"]
path= deps/spdlog
url=https://github.com/gabime/spdlog.git
`
;
.
deepStrictEqual
(
parseGitmodules
(
)
,
[
{
:
'deps/spdlog'
,
:
'deps/spdlog'
,
:
'https://github.com/gabime/spdlog.git'
}
]
)
;
}
)
;
}
)
;
suite
(
'parseGitRemotes'
,
(
)
=>
{
test
(
'empty'
,
(
)
=>
{
.
deepStrictEqual
(
parseGitRemotes
(
''
)
,
[
]
)
;
}
)
;
test
(
'single remote'
,
(
)
=>
{
const
=
` [remote "origin"]
url = https://github.com/microsoft/vscode.git
fetch = +refs/heads/*:refs/remotes/origin/*
`
;
.
deepStrictEqual
(
parseGitRemotes
(
)
,
[
{
:
'origin'
,
:
'https://github.com/microsoft/vscode.git'
,
:
'https://github.com/microsoft/vscode.git'
,
:
false
}
]
)
;
}
)
;
test
(
'single remote (multiple urls)'
,
(
)
=>
{
const
=
` [remote "origin"]
url = https://github.com/microsoft/vscode.git
url = https://github.com/microsoft/vscode2.git
fetch = +refs/heads/*:refs/remotes/origin/*
`
;
.
deepStrictEqual
(
parseGitRemotes
(
)
,
[
{
:
'origin'
,
:
'https://github.com/microsoft/vscode.git'
,
:
'https://github.com/microsoft/vscode.git'
,
:
false
}
]
)
;
}
)
;
test
(
'multiple remotes'
,
(
)
=>
{
const
=
` [remote "origin"]
url = https://github.com/microsoft/vscode.git
pushurl = https://github.com/microsoft/vscode1.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "remote2"]
url = https://github.com/microsoft/vscode2.git
fetch = +refs/heads/*:refs/remotes/origin/*
`
;
.
deepStrictEqual
(
parseGitRemotes
(
)
,
[
{
:
'origin'
,
:
'https://github.com/microsoft/vscode.git'
,
:
'https://github.com/microsoft/vscode1.git'
,
:
false
}
,
{
:
'remote2'
,
:
'https://github.com/microsoft/vscode2.git'
,
:
'https://github.com/microsoft/vscode2.git'
,
:
false
}
]
)
;
}
)
;
test
(
'remotes (white space)'
,
(
)
=>
{
const
=
` [remote "origin"]
url = https://github.com/microsoft/vscode.git
pushurl=https://github.com/microsoft/vscode1.git
fetch = +refs/heads/*:refs/remotes/origin/*
[ remote"remote2"]
url = https://github.com/microsoft/vscode2.git
fetch = +refs/heads/*:refs/remotes/origin/*
`
;
.
deepStrictEqual
(
parseGitRemotes
(
)
,
[
{
:
'origin'
,
:
'https://github.com/microsoft/vscode.git'
,
:
'https://github.com/microsoft/vscode1.git'
,
:
false
}
,
{
:
'remote2'
,
:
'https://github.com/microsoft/vscode2.git'
,
:
'https://github.com/microsoft/vscode2.git'
,
:
false
}
]
)
;
}
)
;
test
(
'remotes (invalid section)'
,
(
)
=>
{
const
=
` [remote "origin"
url = https://github.com/microsoft/vscode.git
pushurl = https://github.com/microsoft/vscode1.git
fetch = +refs/heads/*:refs/remotes/origin/*
`
;
.
deepStrictEqual
(
parseGitRemotes
(
)
,
[
]
)
;
}
)
;
}
)
;
suite
(
'parseGitCommit'
,
(
)
=>
{
test
(
'single parent commit'
,
function
(
)
{
const
GIT_OUTPUT_SINGLE_PARENT
=
'52c293a05038d865604c2284aa8698bd087915a1\n'
+
'John Doe\n'
+
'john.doe@mail.com\n'
+
'1580811030\n'
+
'1580811031\n'
+
'8e5a374372b8393906c7e380dbb09349c5385554\n'
+
'main,branch\n'
+
'This is a commit message.\x00'
;
.
deepStrictEqual
(
parseGitCommits
(
GIT_OUTPUT_SINGLE_PARENT
)
,
[
{
:
'52c293a05038d865604c2284aa8698bd087915a1'
,
:
'This is a commit message.'
,
:
[
'8e5a374372b8393906c7e380dbb09349c5385554'
]
,
:
new
Date
(
1580811030000
)
,
:
'John Doe'
,
:
'john.doe@mail.com'
,
:
new
Date
(
1580811031000
)
,
:
[
'main'
,
'branch'
]
,
:
undefined
,
:
[
]
}
]
)
;
}
)
;
test
(
'multiple parent commits'
,
function
(
)
{
const
GIT_OUTPUT_MULTIPLE_PARENTS
=
'52c293a05038d865604c2284aa8698bd087915a1\n'
+
'John Doe\n'
+
'john.doe@mail.com\n'
+
'1580811030\n'
+
'1580811031\n'
+
'8e5a374372b8393906c7e380dbb09349c5385554 df27d8c75b129ab9b178b386077da2822101b217\n'
+
'main\n'
+
'This is a commit message.\x00'
;
.
deepStrictEqual
(
parseGitCommits
(
GIT_OUTPUT_MULTIPLE_PARENTS
)
,
[
{
:
'52c293a05038d865604c2284aa8698bd087915a1'
,
:
'This is a commit message.'
,
:
[
'8e5a374372b8393906c7e380dbb09349c5385554'
,
'df27d8c75b129ab9b178b386077da2822101b217'
]
,
:
new
Date
(
1580811030000
)
,
:
'John Doe'
,
:
'john.doe@mail.com'
,
:
new
Date
(
1580811031000
)
,
:
[
'main'
]
,
:
undefined
,
:
[
]
}
]
)
;
}
)
;
test
(
'no parent commits'
,
function
(
)
{
const
GIT_OUTPUT_NO_PARENTS
=
'52c293a05038d865604c2284aa8698bd087915a1\n'
+
'John Doe\n'
+
'john.doe@mail.com\n'
+
'1580811030\n'
+
'1580811031\n'
+
'\n'
+
'main\n'
+
'This is a commit message.\x00'
;
.
deepStrictEqual
(
parseGitCommits
(
GIT_OUTPUT_NO_PARENTS
)
,
[
{
:
'52c293a05038d865604c2284aa8698bd087915a1'
,
:
'This is a commit message.'
,
:
[
]
,
:
new
Date
(
1580811030000
)
,
:
'John Doe'
,
:
'john.doe@mail.com'
,
:
new
Date
(
1580811031000
)
,
:
[
'main'
]
,
:
undefined
,
:
[
]
}
]
)
;
}
)
;
test
(
'commit with shortstat'
,
function
(
)
{
const
GIT_OUTPUT_SINGLE_PARENT
=
'52c293a05038d865604c2284aa8698bd087915a1\n'
+
'John Doe\n'
+
'john.doe@mail.com\n'
+
'1580811030\n'
+
'1580811031\n'
+
'8e5a374372b8393906c7e380dbb09349c5385554\n'
+
'main,branch\n'
+
'This is a commit message.\x00\n'
+
' 1 file changed, 2 insertions(+), 3 deletion(-)'
;
.
deepStrictEqual
(
parseGitCommits
(
GIT_OUTPUT_SINGLE_PARENT
)
,
[
{
:
'52c293a05038d865604c2284aa8698bd087915a1'
,
:
'This is a commit message.'
,
:
[
'8e5a374372b8393906c7e380dbb09349c5385554'
]
,
:
new
Date
(
1580811030000
)
,
:
'John Doe'
,
:
'john.doe@mail.com'
,
:
new
Date
(
1580811031000
)
,
:
[
'main'
,
'branch'
]
,
:
{
:
3
,
:
1
,
:
2
}
,
:
[
]
}
]
)
;
}
)
;
test
(
'commit with shortstat (no insertions)'
,
function
(
)
{
const
GIT_OUTPUT_SINGLE_PARENT
=
'52c293a05038d865604c2284aa8698bd087915a1\n'
+
'John Doe\n'
+
'john.doe@mail.com\n'
+
'1580811030\n'
+
'1580811031\n'
+
'8e5a374372b8393906c7e380dbb09349c5385554\n'
+
'main,branch\n'
+
'This is a commit message.\x00\n'
+
' 1 file changed, 3 deletion(-)'
;
.
deepStrictEqual
(
parseGitCommits
(
GIT_OUTPUT_SINGLE_PARENT
)
,
[
{
:
'52c293a05038d865604c2284aa8698bd087915a1'
,
:
'This is a commit message.'
,
:
[
'8e5a374372b8393906c7e380dbb09349c5385554'
]
,
:
new
Date
(
1580811030000
)
,
:
'John Doe'
,
:
'john.doe@mail.com'
,
:
new
Date
(
1580811031000
)
,
:
[
'main'
,
'branch'
]
,
:
{
:
3
,
:
1
,
:
0
}
,
:
[
]
}
]
)
;
}
)
;
test
(
'commit with shortstat (no deletions)'
,
function
(
)
{
const
GIT_OUTPUT_SINGLE_PARENT
=
'52c293a05038d865604c2284aa8698bd087915a1\n'
+
'John Doe\n'
+
'john.doe@mail.com\n'
+
'1580811030\n'
+
'1580811031\n'
+
'8e5a374372b8393906c7e380dbb09349c5385554\n'
+
'main,branch\n'
+
'This is a commit message.\x00\n'
+
' 1 file changed, 2 insertions(+)'
;
.
deepStrictEqual
(
parseGitCommits
(
GIT_OUTPUT_SINGLE_PARENT
)
,
[
{
:
'52c293a05038d865604c2284aa8698bd087915a1'
,
:
'This is a commit message.'
,
:
[
'8e5a374372b8393906c7e380dbb09349c5385554'
]
,
:
new
Date
(
1580811030000
)
,
:
'John Doe'
,
:
'john.doe@mail.com'
,
:
new
Date
(
1580811031000
)
,
:
[
'main'
,
'branch'
]
,
:
{
:
0
,
:
1
,
:
2
}
,
:
[
]
}
]
)
;
}
)
;
test
(
'commit list'
,
function
(
)
{
const
GIT_OUTPUT_SINGLE_PARENT
=
'52c293a05038d865604c2284aa8698bd087915a1\n'
+
'John Doe\n'
+
'john.doe@mail.com\n'
+
'1580811030\n'
+
'1580811031\n'
+
'8e5a374372b8393906c7e380dbb09349c5385554\n'
+
'main,branch\n'
+
'This is a commit message.\x00\n'
+
'52c293a05038d865604c2284aa8698bd087915a2\n'
+
'Jane Doe\n'
+
'jane.doe@mail.com\n'
+
'1580811032\n'
+
'1580811033\n'
+
'8e5a374372b8393906c7e380dbb09349c5385555\n'
+
'main,branch\n'
+
'This is another commit message.\x00'
;
.
deepStrictEqual
(
parseGitCommits
(
GIT_OUTPUT_SINGLE_PARENT
)
,
[
{
:
'52c293a05038d865604c2284aa8698bd087915a1'
,
:
'This is a commit message.'
,
:
[
'8e5a374372b8393906c7e380dbb09349c5385554'
]
,
:
new
Date
(
1580811030000
)
,
:
'John Doe'
,
:
'john.doe@mail.com'
,
:
new
Date
(
1580811031000
)
,
:
[
'main'
,
'branch'
]
,
:
undefined
,
:
[
]
}
,
{
:
'52c293a05038d865604c2284aa8698bd087915a2'
,
:
'This is another commit message.'
,
:
[
'8e5a374372b8393906c7e380dbb09349c5385555'
]
,
:
new
Date
(
1580811032000
)
,
:
'Jane Doe'
,
:
'jane.doe@mail.com'
,
:
new
Date
(
1580811033000
)
,
:
[
'main'
,
'branch'
]
,
:
undefined
,
:
[
]
}
,
]
)
;
}
)
;
test
(
'commit list with shortstat'
,
function
(
)
{
const
GIT_OUTPUT_SINGLE_PARENT
=
'52c293a05038d865604c2284aa8698bd087915a1\n'
+
'John Doe\n'
+
'john.doe@mail.com\n'
+
'1580811030\n'
+
'1580811031\n'
+
'8e5a374372b8393906c7e380dbb09349c5385554\n'
+
'main,branch\n'
+
'This is a commit message.\x00\n'
+
' 5 file changed, 12 insertions(+), 13 deletion(-)\n'
+
'52c293a05038d865604c2284aa8698bd087915a2\n'
+
'Jane Doe\n'
+
'jane.doe@mail.com\n'
+
'1580811032\n'
+
'1580811033\n'
+
'8e5a374372b8393906c7e380dbb09349c5385555\n'
+
'main,branch\n'
+
'This is another commit message.\x00\n'
+
' 6 file changed, 22 insertions(+), 23 deletion(-)'
;
.
deepStrictEqual
(
parseGitCommits
(
GIT_OUTPUT_SINGLE_PARENT
)
,
[
{
:
'52c293a05038d865604c2284aa8698bd087915a1'
,
:
'This is a commit message.'
,
:
[
'8e5a374372b8393906c7e380dbb09349c5385554'
]
,
:
new
Date
(
1580811030000
)
,
:
'John Doe'
,
:
'john.doe@mail.com'
,
:
new
Date
(
1580811031000
)
,
:
[
'main'
,
'branch'
]
,
:
{
:
13
,
:
5
,
:
12
}
,
:
[
]
}
,
{
:
'52c293a05038d865604c2284aa8698bd087915a2'
,
:
'This is another commit message.'
,
:
[
'8e5a374372b8393906c7e380dbb09349c5385555'
]
,
:
new
Date
(
1580811032000
)
,
:
'Jane Doe'
,
:
'jane.doe@mail.com'
,
:
new
Date
(
1580811033000
)
,
:
[
'main'
,
'branch'
]
,
:
{
:
23
,
:
6
,
:
22
}
,
:
[
]
}
]
)
;
}
)
;
}
)
;
suite
(
'parseLsTree'
,
function
(
)
{
test
(
'sample'
,
function
(
)
{
const
=
` 040000 tree 0274a81f8ee9ca3669295dc40f510bd2021d0043 - .vscode
100644 blob 1d487c1817262e4f20efbfa1d04c18f51b0046f6 491570 Screen Shot 2018-06-01 at 14.48.05.png
100644 blob 686c16e4f019b734655a2576ce8b98749a9ffdb9 764420 Screen Shot 2018-06-07 at 20.04.59.png
100644 blob 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 4 boom.txt
100644 blob 86dc360dd25f13fa50ffdc8259e9653921f4f2b7 11 boomcaboom.txt
100644 blob a68b14060589b16d7ac75f67b905c918c03c06eb 24 file.js
100644 blob f7bcfb05af46850d780f88c069edcd57481d822d 201 file.md
100644 blob ab8b86114a051f6490f1ec5e3141b9a632fb46b5 8 hello.js
100644 blob 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 4 what.js
100644 blob be859e3f412fa86513cd8bebe8189d1ea1a3e46d 24 what.txt
100644 blob 56ec42c9dc6fcf4534788f0fe34b36e09f37d085 261186 what.txt2 `
;
const
=
parseLsTree
(
)
;
.
deepStrictEqual
(
,
[
{
:
'040000'
,
:
'tree'
,
:
'0274a81f8ee9ca3669295dc40f510bd2021d0043'
,
:
'-'
,
:
'.vscode'
}
,
{
:
'100644'
,
:
'blob'
,
:
'1d487c1817262e4f20efbfa1d04c18f51b0046f6'
,
:
'491570'
,
:
'Screen Shot 2018-06-01 at 14.48.05.png'
}
,
{
:
'100644'
,
:
'blob'
,
:
'686c16e4f019b734655a2576ce8b98749a9ffdb9'
,
:
'764420'
,
:
'Screen Shot 2018-06-07 at 20.04.59.png'
}
,
{
:
'100644'
,
:
'blob'
,
:
'257cc5642cb1a054f08cc83f2d943e56fd3ebe99'
,
:
'4'
,
:
'boom.txt'
}
,
{
:
'100644'
,
:
'blob'
,
:
'86dc360dd25f13fa50ffdc8259e9653921f4f2b7'
,
:
'11'
,
:
'boomcaboom.txt'
}
,
{
:
'100644'
,
:
'blob'
,
:
'a68b14060589b16d7ac75f67b905c918c03c06eb'
,
:
'24'
,
:
'file.js'
}
,
{
:
'100644'
,
:
'blob'
,
:
'f7bcfb05af46850d780f88c069edcd57481d822d'
,
:
'201'
,
:
'file.md'
}
,
{
:
'100644'
,
:
'blob'
,
:
'ab8b86114a051f6490f1ec5e3141b9a632fb46b5'
,
:
'8'
,
:
'hello.js'
}
,
{
:
'100644'
,
:
'blob'
,
:
'257cc5642cb1a054f08cc83f2d943e56fd3ebe99'
,
:
'4'
,
:
'what.js'
}
,
{
:
'100644'
,
:
'blob'
,
:
'be859e3f412fa86513cd8bebe8189d1ea1a3e46d'
,
:
'24'
,
:
'what.txt'
}
,
{
:
'100644'
,
:
'blob'
,
:
'56ec42c9dc6fcf4534788f0fe34b36e09f37d085'
,
:
'261186'
,
:
'what.txt2'
}
]
)
;
}
)
;
}
)
;
suite
(
'parseLsFiles'
,
function
(
)
{
test
(
'sample'
,
function
(
)
{
const
=
` 100644 7a73a41bfdf76d6f793007240d80983a52f15f97 0 .vscode/settings.json
100644 1d487c1817262e4f20efbfa1d04c18f51b0046f6 0 Screen Shot 2018-06-01 at 14.48.05.png
100644 686c16e4f019b734655a2576ce8b98749a9ffdb9 0 Screen Shot 2018-06-07 at 20.04.59.png
100644 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 0 boom.txt
100644 86dc360dd25f13fa50ffdc8259e9653921f4f2b7 0 boomcaboom.txt
100644 a68b14060589b16d7ac75f67b905c918c03c06eb 0 file.js
100644 f7bcfb05af46850d780f88c069edcd57481d822d 0 file.md
100644 ab8b86114a051f6490f1ec5e3141b9a632fb46b5 0 hello.js
100644 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 0 what.js
100644 be859e3f412fa86513cd8bebe8189d1ea1a3e46d 0 what.txt
100644 56ec42c9dc6fcf4534788f0fe34b36e09f37d085 0 what.txt2 `
;
const
=
parseLsFiles
(
)
;
.
deepStrictEqual
(
,
[
{
:
'100644'
,
:
'7a73a41bfdf76d6f793007240d80983a52f15f97'
,
:
'0'
,
:
'.vscode/settings.json'
}
,
{
:
'100644'
,
:
'1d487c1817262e4f20efbfa1d04c18f51b0046f6'
,
:
'0'
,
:
'Screen Shot 2018-06-01 at 14.48.05.png'
}
,
{
:
'100644'
,
:
'686c16e4f019b734655a2576ce8b98749a9ffdb9'
,
:
'0'
,
:
'Screen Shot 2018-06-07 at 20.04.59.png'
}
,
{
:
'100644'
,
:
'257cc5642cb1a054f08cc83f2d943e56fd3ebe99'
,
:
'0'
,
:
'boom.txt'
}
,
{
:
'100644'
,
:
'86dc360dd25f13fa50ffdc8259e9653921f4f2b7'
,
:
'0'
,
:
'boomcaboom.txt'
}
,
{
:
'100644'
,
:
'a68b14060589b16d7ac75f67b905c918c03c06eb'
,
:
'0'
,
:
'file.js'
}
,
{
:
'100644'
,
:
'f7bcfb05af46850d780f88c069edcd57481d822d'
,
:
'0'
,
:
'file.md'
}
,
{
:
'100644'
,
:
'ab8b86114a051f6490f1ec5e3141b9a632fb46b5'
,
:
'0'
,
:
'hello.js'
}
,
{
:
'100644'
,
:
'257cc5642cb1a054f08cc83f2d943e56fd3ebe99'
,
:
'0'
,
:
'what.js'
}
,
{
:
'100644'
,
:
'be859e3f412fa86513cd8bebe8189d1ea1a3e46d'
,
:
'0'
,
:
'what.txt'
}
,
{
:
'100644'
,
:
'56ec42c9dc6fcf4534788f0fe34b36e09f37d085'
,
:
'0'
,
:
'what.txt2'
}
,
]
)
;
}
)
;
}
)
;
suite
(
'parseCoAuthors'
,
(
)
=>
{
test
(
'no co-authors'
,
function
(
)
{
.
deepStrictEqual
(
parseCoAuthors
(
'This is a commit message.'
)
,
[
]
)
;
}
)
;
test
(
'single co-author'
,
function
(
)
{
.
deepStrictEqual
(
parseCoAuthors
(
'Fix bug\n\nCo-authored-by: Jane Doe <jane@example.com>'
)
,
[
{
:
'Jane Doe'
,
:
'jane@example.com'
}
]
)
;
}
)
;
test
(
'multiple co-authors'
,
function
(
)
{
.
deepStrictEqual
(
parseCoAuthors
(
'Fix bug\n\nCo-authored-by: Jane Doe <jane@example.com>\nCo-authored-by: Bob Smith <bob@example.com>'
)
,
[
{
:
'Jane Doe'
,
:
'jane@example.com'
}
,
{
:
'Bob Smith'
,
:
'bob@example.com'
}
]
)
;
}
)
;
test
(
'case insensitive'
,
function
(
)
{
.
deepStrictEqual
(
parseCoAuthors
(
'Fix bug\n\nco-authored-by: Jane Doe <jane@example.com>'
)
,
[
{
:
'Jane Doe'
,
:
'jane@example.com'
}
]
)
;
}
)
;
test
(
'AI co-author (Copilot)'
,
function
(
)
{
.
deepStrictEqual
(
parseCoAuthors
(
'Fix bug\n\nCo-authored-by: Copilot <copilot@github.com>'
)
,
[
{
:
'Copilot'
,
:
'copilot@github.com'
}
]
)
;
}
)
;
test
(
'mixed with other trailers'
,
function
(
)
{
.
deepStrictEqual
(
parseCoAuthors
(
'Fix bug\n\nSigned-off-by: Admin <admin@corp.com>\nCo-authored-by: Jane Doe <jane@example.com>'
)
,
[
{
:
'Jane Doe'
,
:
'jane@example.com'
}
]
)
;
}
)
;
}
)
;
suite
(
'splitInChunks'
,
(
)
=>
{
test
(
'unit tests'
,
function
(
)
{
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'hello'
,
'there'
,
'cool'
,
'stuff'
]
,
6
)
]
,
[
[
'hello'
]
,
[
'there'
]
,
[
'cool'
]
,
[
'stuff'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'hello'
,
'there'
,
'cool'
,
'stuff'
]
,
10
)
]
,
[
[
'hello'
,
'there'
]
,
[
'cool'
,
'stuff'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'hello'
,
'there'
,
'cool'
,
'stuff'
]
,
12
)
]
,
[
[
'hello'
,
'there'
]
,
[
'cool'
,
'stuff'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'hello'
,
'there'
,
'cool'
,
'stuff'
]
,
14
)
]
,
[
[
'hello'
,
'there'
,
'cool'
]
,
[
'stuff'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'hello'
,
'there'
,
'cool'
,
'stuff'
]
,
2000
)
]
,
[
[
'hello'
,
'there'
,
'cool'
,
'stuff'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
]
,
1
)
]
,
[
[
'0'
]
,
[
'01'
]
,
[
'012'
]
,
[
'0'
]
,
[
'01'
]
,
[
'012'
]
,
[
'0'
]
,
[
'01'
]
,
[
'012'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
]
,
2
)
]
,
[
[
'0'
]
,
[
'01'
]
,
[
'012'
]
,
[
'0'
]
,
[
'01'
]
,
[
'012'
]
,
[
'0'
]
,
[
'01'
]
,
[
'012'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
]
,
3
)
]
,
[
[
'0'
,
'01'
]
,
[
'012'
]
,
[
'0'
,
'01'
]
,
[
'012'
]
,
[
'0'
,
'01'
]
,
[
'012'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
]
,
4
)
]
,
[
[
'0'
,
'01'
]
,
[
'012'
,
'0'
]
,
[
'01'
]
,
[
'012'
,
'0'
]
,
[
'01'
]
,
[
'012'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
]
,
5
)
]
,
[
[
'0'
,
'01'
]
,
[
'012'
,
'0'
]
,
[
'01'
,
'012'
]
,
[
'0'
,
'01'
]
,
[
'012'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
]
,
6
)
]
,
[
[
'0'
,
'01'
,
'012'
]
,
[
'0'
,
'01'
,
'012'
]
,
[
'0'
,
'01'
,
'012'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
]
,
7
)
]
,
[
[
'0'
,
'01'
,
'012'
,
'0'
]
,
[
'01'
,
'012'
,
'0'
]
,
[
'01'
,
'012'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
]
,
8
)
]
,
[
[
'0'
,
'01'
,
'012'
,
'0'
]
,
[
'01'
,
'012'
,
'0'
,
'01'
]
,
[
'012'
]
]
)
;
.
deepStrictEqual
(
[
...
splitInChunks
(
[
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
,
'0'
,
'01'
,
'012'
]
,
9
)
]
,
[
[
'0'
,
'01'
,
'012'
,
'0'
,
'01'
]
,
[
'012'
,
'0'
,
'01'
,
'012'
]
]
)
;
}
)
;
}
)
;
}
)
;