@@ -44,20 +44,17 @@ func TestDiffSection_Line(t *testing.T) {
44
44
{
45
45
Type : DiffLineSection ,
46
46
Content : "@@ -1,7 +1,7 @@" ,
47
- },
48
- {
47
+ }, {
49
48
Type : DiffLinePlain ,
50
49
Content : ` <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` ,
51
50
LeftLine : 1 ,
52
51
RightLine : 1 ,
53
- },
54
- {
52
+ }, {
55
53
Type : DiffLinePlain ,
56
54
Content : ` xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">` ,
57
55
LeftLine : 2 ,
58
56
RightLine : 2 ,
59
- },
60
- {
57
+ }, {
61
58
Type : DiffLinePlain ,
62
59
Content : ` <modelVersion>4.0.0</modelVersion>` ,
63
60
LeftLine : 3 ,
@@ -70,14 +67,12 @@ func TestDiffSection_Line(t *testing.T) {
70
67
Content : ` <artifactId>egitdemo</artifactId>` ,
71
68
LeftLine : 5 ,
72
69
RightLine : 5 ,
73
- },
74
- {
70
+ }, {
75
71
Type : DiffLinePlain ,
76
72
Content : ` <packaging>jar</packaging>` ,
77
73
LeftLine : 6 ,
78
74
RightLine : 6 ,
79
- },
80
- {
75
+ }, {
81
76
Type : DiffLinePlain ,
82
77
Content : ` <version>1.0-SNAPSHOT</version>` ,
83
78
LeftLine : 7 ,
@@ -199,20 +194,17 @@ index 0000000..6b08f76
199
194
{
200
195
Type : DiffLineSection ,
201
196
Content : "@@ -0,0 +1,3 @@" ,
202
- },
203
- {
197
+ }, {
204
198
Type : DiffLineAdd ,
205
199
Content : `+[submodule "gogs/docs-api"]` ,
206
200
LeftLine : 0 ,
207
201
RightLine : 1 ,
208
- },
209
- {
202
+ }, {
210
203
Type : DiffLineAdd ,
211
204
Content : `+ path = gogs/docs-api` ,
212
205
LeftLine : 0 ,
213
206
RightLine : 2 ,
214
- },
215
- {
207
+ }, {
216
208
Type : DiffLineAdd ,
217
209
Content : `+ url = https://github.com/gogs/docs-api.git` ,
218
210
LeftLine : 0 ,
@@ -240,8 +232,7 @@ index 0000000..6b08f76
240
232
{
241
233
Type : DiffLineSection ,
242
234
Content : "@@ -0,0 +1 @@" ,
243
- },
244
- {
235
+ }, {
245
236
Type : DiffLineAdd ,
246
237
Content : `+Subproject commit 6b08f76a5313fa3d26859515b30aa17a5faa2807` ,
247
238
LeftLine : 0 ,
@@ -291,50 +282,42 @@ index ee791be..9997571 100644
291
282
{
292
283
Type : DiffLineSection ,
293
284
Content : "@@ -1,7 +1,7 @@" ,
294
- },
295
- {
285
+ }, {
296
286
Type : DiffLinePlain ,
297
287
Content : ` <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"` ,
298
288
LeftLine : 1 ,
299
289
RightLine : 1 ,
300
- },
301
- {
290
+ }, {
302
291
Type : DiffLinePlain ,
303
292
Content : ` xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">` ,
304
293
LeftLine : 2 ,
305
294
RightLine : 2 ,
306
- },
307
- {
295
+ }, {
308
296
Type : DiffLinePlain ,
309
297
Content : ` <modelVersion>4.0.0</modelVersion>` ,
310
298
LeftLine : 3 ,
311
299
RightLine : 3 ,
312
- },
313
- {
300
+ }, {
314
301
Type : DiffLineDelete ,
315
302
Content : `- <groupId>com.ambientideas</groupId>` ,
316
303
LeftLine : 4 ,
317
304
RightLine : 0 ,
318
- },
319
- {
305
+ }, {
320
306
Type : DiffLineAdd ,
321
307
Content : `+ <groupId>com.github</groupId>` ,
322
308
LeftLine : 0 ,
323
309
RightLine : 4 ,
324
- },
325
- {
310
+ }, {
326
311
Type : DiffLinePlain ,
327
312
Content : ` <artifactId>egitdemo</artifactId>` ,
328
313
LeftLine : 5 ,
329
314
RightLine : 5 ,
330
- },
331
- {
315
+ }, {
332
316
Type : DiffLinePlain ,
333
317
Content : ` <packaging>jar</packaging>` ,
334
318
LeftLine : 6 ,
335
319
RightLine : 6 ,
336
- },
337
- {
320
+ }, {
338
321
Type : DiffLinePlain ,
339
322
Content : ` <version>1.0-SNAPSHOT</version>` ,
340
323
LeftLine : 7 ,
@@ -432,6 +415,70 @@ rename to run.sh`,
432
415
isIncomplete : false ,
433
416
},
434
417
},
418
+ {
419
+ input : `
420
+ diff --git a/dir/file.txt b/dir/file.txt
421
+ index b6fc4c620b67d95f953a5c1c1230aaab5db5a1b0..ab80bda5dd90d8b42be25ac2c7a071b722171f09 100644
422
+ --- a/dir/file.txt
423
+ +++ b/dir/file.txt
424
+ @@ -1 +1,3 @@
425
+ -hello
426
+ \ No newline at end of file
427
+ +hello
428
+ +
429
+ +fdsfdsfds
430
+ \ No newline at end of file` ,
431
+ expDiff : & Diff {
432
+ Files : []* DiffFile {
433
+ {
434
+ Name : "dir/file.txt" ,
435
+ Type : DiffFileChange ,
436
+ Index : "ab80bda5dd90d8b42be25ac2c7a071b722171f09" ,
437
+ Sections : []* DiffSection {
438
+ {
439
+ Lines : []* DiffLine {
440
+ {
441
+ Type : DiffLineSection ,
442
+ Content : "@@ -1 +1,3 @@" ,
443
+ }, {
444
+ Type : DiffLineDelete ,
445
+ Content : `-hello` ,
446
+ LeftLine : 1 ,
447
+ RightLine : 0 ,
448
+ }, {
449
+ Type : DiffLineAdd ,
450
+ Content : `+hello` ,
451
+ LeftLine : 0 ,
452
+ RightLine : 1 ,
453
+ }, {
454
+ Type : DiffLineAdd ,
455
+ Content : `+` ,
456
+ LeftLine : 0 ,
457
+ RightLine : 2 ,
458
+ }, {
459
+ Type : DiffLineAdd ,
460
+ Content : `+fdsfdsfds` ,
461
+ LeftLine : 0 ,
462
+ RightLine : 3 ,
463
+ },
464
+ },
465
+ numAdditions : 3 ,
466
+ numDeletions : 1 ,
467
+ },
468
+ },
469
+ numAdditions : 3 ,
470
+ numDeletions : 1 ,
471
+ oldName : "" ,
472
+ isBinary : false ,
473
+ isSubmodule : false ,
474
+ isIncomplete : false ,
475
+ },
476
+ },
477
+ totalAdditions : 3 ,
478
+ totalDeletions : 1 ,
479
+ isIncomplete : false ,
480
+ },
481
+ },
435
482
{
436
483
input : `diff --git a/.travis.yml b/.travis.yml
437
484
index 335db7ea..51d7543e 100644
@@ -468,56 +515,47 @@ index 335db7ea..51d7543e 100644
468
515
{
469
516
Type : DiffLineSection ,
470
517
Content : "@@ -1,9 +1,6 @@" ,
471
- },
472
- {
518
+ }, {
473
519
Type : DiffLinePlain ,
474
520
Content : ` sudo: false` ,
475
521
LeftLine : 1 ,
476
522
RightLine : 1 ,
477
- },
478
- {
523
+ }, {
479
524
Type : DiffLinePlain ,
480
525
Content : ` language: go` ,
481
526
LeftLine : 2 ,
482
527
RightLine : 2 ,
483
- },
484
- {
528
+ }, {
485
529
Type : DiffLinePlain ,
486
530
Content : ` go:` ,
487
531
LeftLine : 3 ,
488
532
RightLine : 3 ,
489
- },
490
- {
533
+ }, {
491
534
Type : DiffLineDelete ,
492
535
Content : `- - 1.4.x` ,
493
536
LeftLine : 4 ,
494
537
RightLine : 0 ,
495
- },
496
- {
538
+ }, {
497
539
Type : DiffLineDelete ,
498
540
Content : `- - 1.5.x` ,
499
541
LeftLine : 5 ,
500
542
RightLine : 0 ,
501
- },
502
- {
543
+ }, {
503
544
Type : DiffLineDelete ,
504
545
Content : `- - 1.6.x` ,
505
546
LeftLine : 6 ,
506
547
RightLine : 0 ,
507
- },
508
- {
548
+ }, {
509
549
Type : DiffLinePlain ,
510
550
Content : ` - 1.7.x` ,
511
551
LeftLine : 7 ,
512
552
RightLine : 4 ,
513
- },
514
- {
553
+ }, {
515
554
Type : DiffLinePlain ,
516
555
Content : ` - 1.8.x` ,
517
556
LeftLine : 8 ,
518
557
RightLine : 5 ,
519
- },
520
- {
558
+ }, {
521
559
Type : DiffLinePlain ,
522
560
Content : ` - 1.9.x` ,
523
561
LeftLine : 9 ,
@@ -564,14 +602,12 @@ index 0000000..6abde17
564
602
{
565
603
Type : DiffLineSection ,
566
604
Content : "@@ -0,0 +1,3 @@" ,
567
- },
568
- {
605
+ }, {
569
606
Type : DiffLineAdd ,
570
607
Content : `+[submodule "gogs/docs-api"]` ,
571
608
LeftLine : 0 ,
572
609
RightLine : 1 ,
573
- },
574
- {
610
+ }, {
575
611
Type : DiffLineAdd ,
576
612
Content : `+ path = gogs/docs-api` ,
577
613
LeftLine : 0 ,
@@ -627,14 +663,12 @@ index 0000000..6b08f76
627
663
{
628
664
Type : DiffLineSection ,
629
665
Content : "@@ -0,0 +1,3 @@" ,
630
- },
631
- {
666
+ }, {
632
667
Type : DiffLineAdd ,
633
668
Content : `+[submodule "gogs/docs-api"]` ,
634
669
LeftLine : 0 ,
635
670
RightLine : 1 ,
636
- },
637
- {
671
+ }, {
638
672
Type : DiffLineAdd ,
639
673
Content : `+ path = gogs/docs-api` ,
640
674
LeftLine : 0 ,
0 commit comments