Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mjambon opened this issue Oct 24, 2023 · 0 comments
Assignees
Labels
feature request Big and small feature requests

Comments

@mjambon
Copy link
Collaborator

mjambon commented Oct 24, 2023

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 atddiff: provide output without line/column info for more stable results #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:

  • Consult the MERGED environment variable to obtain the path to the checked-out version of the file.
  • Don't print the path to the input files since they're temporary.
  • Print a git commit ID for each version of the file if possible (?)
@mjambon mjambon self-assigned this Oct 24, 2023
@mjambon mjambon added the feature request Big and small feature requests label Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Big and small feature requests
Projects
None yet
Development

No branches or pull requests

1 participant