Commit b213c8a
authored
feat: make diff without libgit2 (#344)
resolves #303
This uses a pure-rust library called [imara-diff], which has been forked
by the [gitoxide] project as a library named [gix-imara-diff]. I'm using
the fork because the [imara-diff] lib has not been updated as recently
as [gix-imara-diff]. Also, the [gix-imara-diff] is what is being used in
the [gitoxide] project, so I think it is better maintained with a
`git`-based focus in mind.
It boasts the same unified diff algorithms as used by `git` CLI. In
fact, the [gitoxide] project is intended to be a rust implementation of
`git` CLI and provides an API comparable to libgit2 (but with much more
separation of concerns).
Creating and traversing a diff was the remaining use of libgit2 in our
production code. Thus, libgit2 has been removed from our dependencies.
However, the benchmark still uses libgit2 as the sample source files.
Additionally, libgit2 had some memory safety concerns and because it is
written in C, so [gix-imara-diff] should be safer to use with no
unexpected panics at runtime.
[imara-diff]: https://github.com/pascalkuthe/imara-diff
[gix-imara-diff]:
https://github.com/GitoxideLabs/gitoxide/tree/main/gix-imara-diff
[gitoxide]: https://github.com/GitoxideLabs/gitoxide1 parent cdc871a commit b213c8a
6 files changed
Lines changed: 84 additions & 196 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
308 | 301 | | |
309 | 302 | | |
310 | 303 | | |
| |||
320 | 313 | | |
321 | 314 | | |
322 | 315 | | |
323 | | - | |
| 316 | + | |
| 317 | + | |
324 | 318 | | |
325 | | - | |
| 319 | + | |
326 | 320 | | |
327 | | - | |
328 | | - | |
329 | 321 | | |
330 | 322 | | |
331 | 323 | | |
332 | 324 | | |
333 | 325 | | |
334 | 326 | | |
335 | | - | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
350 | 335 | | |
351 | 336 | | |
352 | | - | |
| 337 | + | |
353 | 338 | | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
| 339 | + | |
| 340 | + | |
363 | 341 | | |
364 | 342 | | |
365 | 343 | | |
366 | 344 | | |
367 | 345 | | |
368 | 346 | | |
369 | 347 | | |
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 | | - | |
| 348 | + | |
400 | 349 | | |
401 | 350 | | |
402 | 351 | | |
403 | | - | |
404 | | - | |
| 352 | + | |
405 | 353 | | |
406 | 354 | | |
407 | 355 | | |
408 | 356 | | |
409 | 357 | | |
410 | | - | |
| 358 | + | |
411 | 359 | | |
412 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
413 | 368 | | |
414 | 369 | | |
415 | 370 | | |
| |||
423 | 378 | | |
424 | 379 | | |
425 | 380 | | |
426 | | - | |
427 | | - | |
428 | | - | |
| 381 | + | |
| 382 | + | |
429 | 383 | | |
430 | 384 | | |
0 commit comments