@@ -144,6 +144,8 @@ func TestDiff(t *testing.T) {
144
144
isBinary : false ,
145
145
isSubmodule : false ,
146
146
isIncomplete : false ,
147
+ mode : 100644 ,
148
+ oldMode : 100644 ,
147
149
},
148
150
},
149
151
totalAdditions : 10 ,
@@ -185,9 +187,10 @@ index 0000000..6b08f76
185
187
expDiff : & Diff {
186
188
Files : []* DiffFile {
187
189
{
188
- Name : ".gitmodules" ,
189
- Type : DiffFileAdd ,
190
- Index : "6abde17" ,
190
+ Name : ".gitmodules" ,
191
+ Type : DiffFileAdd ,
192
+ Index : "6abde17" ,
193
+ OldIndex : "0000000" ,
191
194
Sections : []* DiffSection {
192
195
{
193
196
Lines : []* DiffLine {
@@ -217,15 +220,18 @@ index 0000000..6b08f76
217
220
},
218
221
numAdditions : 3 ,
219
222
numDeletions : 0 ,
220
- oldName : "" ,
223
+ oldName : ".gitmodules " ,
221
224
isBinary : false ,
222
225
isSubmodule : false ,
223
226
isIncomplete : false ,
227
+ mode : 0100644 ,
228
+ oldMode : 0100644 ,
224
229
},
225
230
{
226
- Name : "gogs/docs-api" ,
227
- Type : DiffFileAdd ,
228
- Index : "6b08f76" ,
231
+ Name : "gogs/docs-api" ,
232
+ Type : DiffFileAdd ,
233
+ Index : "6b08f76" ,
234
+ OldIndex : "0000000" ,
229
235
Sections : []* DiffSection {
230
236
{
231
237
Lines : []* DiffLine {
@@ -245,10 +251,12 @@ index 0000000..6b08f76
245
251
},
246
252
numAdditions : 1 ,
247
253
numDeletions : 0 ,
248
- oldName : "" ,
254
+ oldName : "gogs/docs-api " ,
249
255
isBinary : false ,
250
256
isSubmodule : true ,
251
257
isIncomplete : false ,
258
+ mode : 0160000 ,
259
+ oldMode : 0160000 ,
252
260
},
253
261
},
254
262
totalAdditions : 4 ,
@@ -273,9 +281,10 @@ index ee791be..9997571 100644
273
281
expDiff : & Diff {
274
282
Files : []* DiffFile {
275
283
{
276
- Name : "pom.xml" ,
277
- Type : DiffFileChange ,
278
- Index : "9997571" ,
284
+ Name : "pom.xml" ,
285
+ Type : DiffFileChange ,
286
+ Index : "9997571" ,
287
+ OldIndex : "ee791be" ,
279
288
Sections : []* DiffSection {
280
289
{
281
290
Lines : []* DiffLine {
@@ -330,10 +339,12 @@ index ee791be..9997571 100644
330
339
},
331
340
numAdditions : 1 ,
332
341
numDeletions : 1 ,
333
- oldName : "" ,
342
+ oldName : "pom.xml " ,
334
343
isBinary : false ,
335
344
isSubmodule : false ,
336
345
isIncomplete : false ,
346
+ oldMode : 0100644 ,
347
+ mode : 0100644 ,
337
348
},
338
349
},
339
350
totalAdditions : 1 ,
@@ -352,13 +363,16 @@ Binary files /dev/null and b/img/sourcegraph.png differ`,
352
363
Name : "img/sourcegraph.png" ,
353
364
Type : DiffFileAdd ,
354
365
Index : "2ce9188" ,
366
+ OldIndex : "0000000" ,
355
367
Sections : nil ,
356
368
numAdditions : 0 ,
357
369
numDeletions : 0 ,
358
- oldName : "" ,
370
+ oldName : "img/sourcegraph.png " ,
359
371
isBinary : true ,
360
372
isSubmodule : false ,
361
373
isIncomplete : false ,
374
+ mode : 0100644 ,
375
+ oldMode : 0100644 ,
362
376
},
363
377
},
364
378
totalAdditions : 0 ,
@@ -375,14 +389,17 @@ index e69de29..0000000`,
375
389
{
376
390
Name : "fix.txt" ,
377
391
Type : DiffFileDelete ,
378
- Index : "e69de29" ,
392
+ Index : "0000000" ,
393
+ OldIndex : "e69de29" ,
379
394
Sections : nil ,
380
395
numAdditions : 0 ,
381
396
numDeletions : 0 ,
382
- oldName : "" ,
397
+ oldName : "fix.txt " ,
383
398
isBinary : false ,
384
399
isSubmodule : false ,
385
400
isIncomplete : false ,
401
+ mode : 0100644 ,
402
+ oldMode : 0100644 ,
386
403
},
387
404
},
388
405
totalAdditions : 0 ,
@@ -431,9 +448,10 @@ index b6fc4c620b67d95f953a5c1c1230aaab5db5a1b0..ab80bda5dd90d8b42be25ac2c7a071b7
431
448
expDiff : & Diff {
432
449
Files : []* DiffFile {
433
450
{
434
- Name : "dir/file.txt" ,
435
- Type : DiffFileChange ,
436
- Index : "ab80bda5dd90d8b42be25ac2c7a071b722171f09" ,
451
+ Name : "dir/file.txt" ,
452
+ Type : DiffFileChange ,
453
+ Index : "ab80bda5dd90d8b42be25ac2c7a071b722171f09" ,
454
+ OldIndex : "b6fc4c620b67d95f953a5c1c1230aaab5db5a1b0" ,
437
455
Sections : []* DiffSection {
438
456
{
439
457
Lines : []* DiffLine {
@@ -468,10 +486,12 @@ index b6fc4c620b67d95f953a5c1c1230aaab5db5a1b0..ab80bda5dd90d8b42be25ac2c7a071b7
468
486
},
469
487
numAdditions : 3 ,
470
488
numDeletions : 1 ,
471
- oldName : "" ,
489
+ oldName : "dir/file.txt " ,
472
490
isBinary : false ,
473
491
isSubmodule : false ,
474
492
isIncomplete : false ,
493
+ mode : 0100644 ,
494
+ oldMode : 0100644 ,
475
495
},
476
496
},
477
497
totalAdditions : 3 ,
@@ -499,9 +519,10 @@ index ce53c7e..56a156b 100644
499
519
expDiff : & Diff {
500
520
Files : []* DiffFile {
501
521
{
502
- Name : "src/app/tabs/friends/friends.module.ts" ,
503
- Type : DiffFileRename ,
504
- Index : "56a156b" ,
522
+ Name : "src/app/tabs/friends/friends.module.ts" ,
523
+ Type : DiffFileRename ,
524
+ Index : "56a156b" ,
525
+ OldIndex : "ce53c7e" ,
505
526
Sections : []* DiffSection {
506
527
{
507
528
Lines : []* DiffLine {
@@ -557,6 +578,8 @@ index ce53c7e..56a156b 100644
557
578
numAdditions : 2 ,
558
579
numDeletions : 2 ,
559
580
oldName : "src/app/tabs/teacher/teacher.module.ts" ,
581
+ mode : 0100644 ,
582
+ oldMode : 0100644 ,
560
583
},
561
584
},
562
585
totalAdditions : 2 ,
@@ -590,9 +613,10 @@ index 335db7ea..51d7543e 100644
590
613
expDiff : & Diff {
591
614
Files : []* DiffFile {
592
615
{
593
- Name : ".travis.yml" ,
594
- Type : DiffFileChange ,
595
- Index : "51d7543e" ,
616
+ Name : ".travis.yml" ,
617
+ Type : DiffFileChange ,
618
+ Index : "51d7543e" ,
619
+ OldIndex : "335db7ea" ,
596
620
Sections : []* DiffSection {
597
621
{
598
622
Lines : []* DiffLine {
@@ -652,10 +676,12 @@ index 335db7ea..51d7543e 100644
652
676
},
653
677
numAdditions : 0 ,
654
678
numDeletions : 3 ,
655
- oldName : "" ,
679
+ oldName : ".travis.yml " ,
656
680
isBinary : false ,
657
681
isSubmodule : false ,
658
682
isIncomplete : true ,
683
+ mode : 0100644 ,
684
+ oldMode : 0100644 ,
659
685
},
660
686
},
661
687
totalAdditions : 0 ,
@@ -677,9 +703,10 @@ index 0000000..6abde17
677
703
expDiff : & Diff {
678
704
Files : []* DiffFile {
679
705
{
680
- Name : ".gitmodules" ,
681
- Type : DiffFileAdd ,
682
- Index : "6abde17" ,
706
+ Name : ".gitmodules" ,
707
+ Type : DiffFileAdd ,
708
+ Index : "6abde17" ,
709
+ OldIndex : "0000000" ,
683
710
Sections : []* DiffSection {
684
711
{
685
712
Lines : []* DiffLine {
@@ -704,10 +731,12 @@ index 0000000..6abde17
704
731
},
705
732
numAdditions : 2 ,
706
733
numDeletions : 0 ,
707
- oldName : "" ,
734
+ oldName : ".gitmodules " ,
708
735
isBinary : false ,
709
736
isSubmodule : false ,
710
737
isIncomplete : true ,
738
+ mode : 0100644 ,
739
+ oldMode : 0100644 ,
711
740
},
712
741
},
713
742
totalAdditions : 2 ,
@@ -738,9 +767,10 @@ index 0000000..6b08f76
738
767
expDiff : & Diff {
739
768
Files : []* DiffFile {
740
769
{
741
- Name : ".gitmodules" ,
742
- Type : DiffFileAdd ,
743
- Index : "6abde17" ,
770
+ Name : ".gitmodules" ,
771
+ Type : DiffFileAdd ,
772
+ Index : "6abde17" ,
773
+ OldIndex : "0000000" ,
744
774
Sections : []* DiffSection {
745
775
{
746
776
Lines : []* DiffLine {
@@ -765,17 +795,41 @@ index 0000000..6b08f76
765
795
},
766
796
numAdditions : 2 ,
767
797
numDeletions : 0 ,
768
- oldName : "" ,
798
+ oldName : ".gitmodules " ,
769
799
isBinary : false ,
770
800
isSubmodule : false ,
771
801
isIncomplete : true ,
802
+ mode : 0100644 ,
803
+ oldMode : 0100644 ,
772
804
},
773
805
},
774
806
totalAdditions : 2 ,
775
807
totalDeletions : 0 ,
776
808
isIncomplete : true ,
777
809
},
778
810
},
811
+ {
812
+ input : `diff --git a/go.mod b/go.mod
813
+ old mode 100644
814
+ new mode 100755` ,
815
+ maxFileLines : 0 ,
816
+ maxLineChars : 0 ,
817
+ maxFiles : 1 ,
818
+ expDiff : & Diff {
819
+ Files : []* DiffFile {
820
+ {
821
+ Name : "go.mod" ,
822
+ oldName : "go.mod" ,
823
+ Type : DiffFileChange ,
824
+ mode : 0100755 ,
825
+ oldMode : 0100644 ,
826
+ },
827
+ },
828
+ totalAdditions : 0 ,
829
+ totalDeletions : 0 ,
830
+ isIncomplete : false ,
831
+ },
832
+ },
779
833
}
780
834
for _ , test := range tests {
781
835
t .Run ("" , func (t * testing.T ) {
0 commit comments