ahrefs / atd

Static types for JSON APIs
Other
308 stars 53 forks source link

atddiff: Print the git file path instead of temporary paths when using `git difftool` #378

Open mjambon opened 8 months ago

mjambon commented 8 months ago

git difftool -x atddiff takes two versions of the same file and passes them to atddiff as temporary paths. This results in error messages pointing to nonexistent files.

Problems

  1. This produces spurious diffs although #377 offers a way to solve this.
  2. The actual location of the file isn't provided so it's hard for a human to go and check the error.

Here's a diff between two successive runs of git difftool -x atddiff that should produce the same result:

 Incompatibility in both directions:
-File "/var/folders/gt/kglng66x0wb5l42m3tp4806c0000gp/T//git-blob-tak22U/semgrep_output_v1.atd", line 489, characters 27-34
-File "/var/folders/gt/kglng66x0wb5l42m3tp4806c0000gp/T//git-blob-rDRrHB/semgrep_output_v1.atd", line 390, character 62 to line 438, character 24:
+File "/var/folders/gt/kglng66x0wb5l42m3tp4806c0000gp/T//git-blob-pcSZSS/semgrep_output_v1.atd", line 489, characters 27-34
+File "/var/folders/gt/kglng66x0wb5l42m3tp4806c0000gp/T//git-blob-wIEPak/semgrep_output_v1.atd", line 390, character 62 to line 438, character 24:

Proposed solution

Add a --git option that cause the output to be git-friendly. This could mean: