@@ -219,7 +219,7 @@ fn test_diff_serde() -> Result<(), Error> {
219
219
let diff = repo. diff ( rev_from, rev_to) ?;
220
220
221
221
let json = serde_json:: json!( {
222
- "added " : [ {
222
+ "files " : [ {
223
223
"path" : "LICENSE" ,
224
224
"diff" : {
225
225
"type" : "plain" ,
@@ -248,9 +248,85 @@ fn test_diff_serde() -> Result<(), Error> {
248
248
"mode" : "blob" ,
249
249
"oid" : "02f70f56ec62396ceaf38804c37e169e875ab291" ,
250
250
} ,
251
- } ] ,
252
- "deleted" : [ {
251
+ "state" : "added"
252
+ } ,
253
+ {
254
+ "path" : "README.md" ,
255
+ "diff" : {
256
+ "type" : "plain" ,
257
+ "hunks" : [ {
258
+ "header" : "@@ -1,2 +1,2 @@\n " ,
259
+ "lines" : [
260
+ { "lineNo" : 1 ,
261
+ "line" : "This repository is a data source for the Upstream front-end tests and the\n " ,
262
+ "type" : "deletion"
263
+ } ,
264
+ { "lineNo" : 2 ,
265
+ "line" : "[`radicle-surf`](https://github.com/radicle-dev/git-platinum) unit tests.\n " ,
266
+ "type" : "deletion"
267
+ } ,
268
+ { "lineNo" : 1 ,
269
+ "line" : "This repository is a data source for the upstream front-end tests and the\n " ,
270
+ "type" : "addition"
271
+ } ,
272
+ { "lineNo" : 2 ,
273
+ "line" : "[`radicle-surf`](https://github.com/radicle-dev/radicle-surf) unit tests.\n " ,
274
+ "type" : "addition"
275
+ } ,
276
+ ] ,
277
+ "old" : { "start" : 1 , "end" : 3 } ,
278
+ "new" : { "start" : 1 , "end" : 3 } ,
279
+ } ] ,
280
+ "stats" : {
281
+ "additions" : 2 ,
282
+ "deletions" : 2
283
+ } ,
284
+ "eof" : "noneMissing" ,
285
+ } ,
286
+ "new" : {
287
+ "mode" : "blob" ,
288
+ "oid" : "b033ecf407a44922b28c942c696922a7d7daf06e" ,
289
+ } ,
290
+ "old" : {
291
+ "mode" : "blob" ,
292
+ "oid" : "5e07534cd74a6a9b2ccd2729b181c4ef26173a5e" ,
293
+ } ,
294
+ "state" : "modified" ,
295
+ } ,
296
+ {
297
+ "current" : {
298
+ "mode" : "blob" ,
299
+ "oid" : "1570277532948712fea9029d100a4208f9e34241" ,
300
+ } ,
301
+ "oldPath" : "text/emoji.txt" ,
302
+ "newPath" : "emoji.txt" ,
303
+ "state" : "moved"
304
+ } ,
305
+ {
306
+ "diff" : {
307
+ "eof" : "noneMissing" ,
308
+ "hunks" : [ ] ,
309
+ "stats" : {
310
+ "additions" : 0 ,
311
+ "deletions" : 0 ,
312
+ } ,
313
+ "type" : "plain" ,
314
+ } ,
315
+ "new" : {
316
+ "mode" : "blob" ,
317
+ "oid" : "5e07534cd74a6a9b2ccd2729b181c4ef26173a5e" ,
318
+ } ,
319
+ "newPath" : "file_operations/copied.md" ,
320
+ "old" : {
321
+ "mode" : "blob" ,
322
+ "oid" : "5e07534cd74a6a9b2ccd2729b181c4ef26173a5e" ,
323
+ } ,
324
+ "oldPath" : "README.md" ,
325
+ "state" : "copied"
326
+ } ,
327
+ {
253
328
"path" : "text/arrows.txt" ,
329
+ "state" : "deleted" ,
254
330
"old" : {
255
331
"mode" : "blob" ,
256
332
"oid" : "95418c04010a3cc758fb3a37f9918465f147566f" ,
@@ -306,77 +382,6 @@ fn test_diff_serde() -> Result<(), Error> {
306
382
"eof" : "noneMissing" ,
307
383
} ,
308
384
} ] ,
309
- "moved" : [ {
310
- "current" : {
311
- "mode" : "blob" ,
312
- "oid" : "1570277532948712fea9029d100a4208f9e34241" ,
313
- } ,
314
- "oldPath" : "text/emoji.txt" ,
315
- "newPath" : "emoji.txt" ,
316
- } ] ,
317
- "copied" : [ {
318
- "diff" : {
319
- "eof" : "noneMissing" ,
320
- "hunks" : [ ] ,
321
- "stats" : {
322
- "additions" : 0 ,
323
- "deletions" : 0 ,
324
- } ,
325
- "type" : "plain" ,
326
- } ,
327
- "new" : {
328
- "mode" : "blob" ,
329
- "oid" : "5e07534cd74a6a9b2ccd2729b181c4ef26173a5e" ,
330
- } ,
331
- "newPath" : "file_operations/copied.md" ,
332
- "old" : {
333
- "mode" : "blob" ,
334
- "oid" : "5e07534cd74a6a9b2ccd2729b181c4ef26173a5e" ,
335
- } ,
336
- "oldPath" : "README.md" ,
337
- } ] ,
338
- "modified" : [ {
339
- "path" : "README.md" ,
340
- "diff" : {
341
- "type" : "plain" ,
342
- "hunks" : [ {
343
- "header" : "@@ -1,2 +1,2 @@\n " ,
344
- "lines" : [
345
- { "lineNo" : 1 ,
346
- "line" : "This repository is a data source for the Upstream front-end tests and the\n " ,
347
- "type" : "deletion"
348
- } ,
349
- { "lineNo" : 2 ,
350
- "line" : "[`radicle-surf`](https://github.com/radicle-dev/git-platinum) unit tests.\n " ,
351
- "type" : "deletion"
352
- } ,
353
- { "lineNo" : 1 ,
354
- "line" : "This repository is a data source for the upstream front-end tests and the\n " ,
355
- "type" : "addition"
356
- } ,
357
- { "lineNo" : 2 ,
358
- "line" : "[`radicle-surf`](https://github.com/radicle-dev/radicle-surf) unit tests.\n " ,
359
- "type" : "addition"
360
- } ,
361
- ] ,
362
- "old" : { "start" : 1 , "end" : 3 } ,
363
- "new" : { "start" : 1 , "end" : 3 } ,
364
- } ] ,
365
- "stats" : {
366
- "additions" : 2 ,
367
- "deletions" : 2
368
- } ,
369
- "eof" : "noneMissing" ,
370
- } ,
371
- "new" : {
372
- "mode" : "blob" ,
373
- "oid" : "b033ecf407a44922b28c942c696922a7d7daf06e" ,
374
- } ,
375
- "old" : {
376
- "mode" : "blob" ,
377
- "oid" : "5e07534cd74a6a9b2ccd2729b181c4ef26173a5e" ,
378
- } ,
379
- } ] ,
380
385
"stats" : {
381
386
"deletions" : 9 ,
382
387
"filesChanged" : 5 ,
@@ -426,11 +431,7 @@ index 3f69208f3..cbc843c82 100644
426
431
let diff = Diff :: try_from ( diff) . unwrap ( ) ;
427
432
let json = serde_json:: json!(
428
433
{
429
- "added" : [ ] ,
430
- "copied" : [ ] ,
431
- "deleted" : [ ] ,
432
- "modified" : [ ] ,
433
- "moved" : [
434
+ "files" : [
434
435
{
435
436
"diff" : {
436
437
"eof" : "noneMissing" ,
@@ -585,6 +586,7 @@ index 3f69208f3..cbc843c82 100644
585
586
"oid" : "3f69208f30000000000000000000000000000000" ,
586
587
} ,
587
588
"oldPath" : "radicle/src/node/tracking/config.rs" ,
589
+ "state" : "moved"
588
590
} ,
589
591
] ,
590
592
"stats" : {
0 commit comments