-
Notifications
You must be signed in to change notification settings - Fork 416
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
Handle non-existing file in print_diff
#4182
Conversation
Just to clarify, this is so that we don't have to do |
Yes it is a follow-up of #3795. I though the tests were enough but since inside dune diffing is not done, the problem was not apparent. |
Ack. For the |
I just understood that
Can you precise your idea? Should we print the message before going in For the code added in this PR, I would like to print it in a way similar to the one used by the diff tools, so that it is not too dissimilar. So error message could be a solution, but I will see once I understand what must be done in the normal case. |
93b53a4
to
4a8ab17
Compare
The idea was to buffer them together indeed. But thinking about it again that's not going to help.
Seems reasonable. In the normal case, we print the location in the same format as the compiler, so that emacs can pick it up. We should probably do the same when one of the files is absent. This way the user can quickly jump to it and do BTW, I was checking the various diff command and I found that:
This makes me think that we could explicitly use |
When we do that the diff tool print |
I guess we don't often see the mangling happening because Dune prefers |
That's true, but since we print the location before the diff the user knows what file we are talking about. |
I'm seeing the mangling, because my users don't use by default patdiff (so I removed it). |
We print the location of only one file, not both. |
Here is a simple way to avoid the mangling: we could pass the location to |
Yes, but that seems fine to me. Only the first file is promoted to the source tree. The second one is the correction. The second file being missing is not a very interesting case. In fact, I'm not even sure we can reach the case where the second file is missing in
|
I ran what I believe is the same problem when using a set of diff-promote rules like this. For those interested, the symptom was a failure from Dune about resolving symlinks:
Running
|
FTR, we had a discussion about this with @bobot and end up settling for the following design:
(@bobot does match what your memory of this discussion?) I don't think it quite solves your problem @craigfe though. How did you ended up with a symlink there BTW? FTR, a good tool to debug such errors is to pass |
@bobot do you plan to work on this for 3.0? |
4a8ab17
to
f69cf1d
Compare
and promotion in non existent directory Signed-off-by: François Bobot <[email protected]>
f69cf1d
to
6342b22
Compare
Please re-open if this is still relevant |
Diff command don't like that one of the file doesn't exist. The solution implemented is for dune to print the diff when one of the files doesn't exists.
However the current way we do diffing seems strange to me:
Format.eprintf "%a@?" Loc.render (Loc.pp loc);
is used in the middle of the code, so the line is printed at random placeHow to fix that (if it is needed)?
(run ...)
, but should the output of(diff ...)
be redirected in case of(write-stdout-to ...)
?So it is still a draft: