abcxyz / abc

Apache License 2.0
12 stars 3 forks source link

Use `git diff` instead of plain `diff` #553

Closed drevell closed 6 months ago

drevell commented 6 months ago

We've had a couple of issues now where the differences in git behavior between platforms causes problems. diff behaves differently on macos 12 vs macos 14 when coloring diff output, for example. By using git diff instead, we get more uniform behavior and fewer bugs.

This comes at a cost, though. The git diff command is missing some important flags that exist on regular diff, like:

The absence of these flags forces us into a huge hack: to diff two files and output a diff where the files seem to be named p1 and p2, we have to create a temp directory and copy the two files into that temp dir as a/p1 and b/p2. This incurs filesystem overhead and is hacky as heck.

So given this is super hacky, why are we still doing it?

A similar problem exists for the patch command. If this PR is approved, I'll replace patch with git patch next. patch also has inconsistencies across macos versions.