You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running Cram tests on Windows (from a Linux-based project), I ran into a few issues.
I created a .t file and ran the test on Linux, then updated the oracles (with LF as line terminator) to Git.
Then, on Windows (Cygwin, to be more precise), I cloned the git and re-ran the test (with dune test), and everything seemd fine.
However, if I change the .t file (e.g. add a new command, $ ls in the example below) and run dune test, the git diff message contains the entire output, as in:
Here, the ^M clearly shows the issue is the CR added by Windows.
The issue is that, by default on a fresh Cygwin, git config core.autocrlf true is not set. In this kind of setup, it should be. My question is: is there a reason why the result of dune promote does not display the ^M, as git diff does? It could help diagnose such issues earlier.
I then ran git config core.autocrlf true to avoid the issue and obtained the expected diff.
Now, the remaining issue is that, if I change the .t file again (for instance, to add a new command), whenever I run dune test, I get this warning:
warning: in the working copy of 'proj/_build/.sandbox/bff183ecfd14b3674cf935851dd8dc12/default/test/test.t/run.t', LF will be replaced by CRLF the next time Git touches it
Because the message is related to Dune's sandbox directory, I'm afraid there's not much I can do about it. Or is there some configuration that avoids emitting it? Otherwise, could you please confirm that this warning is indeed harmless?
To reproduce it, I simply did (on a Linux) a dune init project, then added a test.t directory with a run.t, inside the test directory, ran dune test, dune promote, committed it to git, and then, on a Cygwin machine (with git config core.autocrlf true set), cloned the project, modified run.t and re-ran dune test.
Specifications
Version of dune (output of dune --version): 3.9.1 on both Linux and Windows
Version of ocaml (output of ocamlc --version): 4.13.1 on Linux, 4.14.0 on Windows
Operating system (distribution and version): Fedora 38, Cygwin 2.925 on Windows 10
The text was updated successfully, but these errors were encountered:
My question is: is there a reason why the result of dune promote does not display the ^M, as git diff does? It could help diagnose such issues earlier.
If memory serves, dune promote tries to avoid reporting whitespace diffs, so it probably uses git diff -w to produce the diff. Perhaps it should call git diff twice; the first one with -w to check if there is a (non-whitespace) diff, and the second one without -w to produce the actual diff to show to the user.
Otherwise, could you please confirm that this warning is indeed harmless?
This warning is harmless. The warning is generated by Git and it is telling you that Git will modify the line endings of the working copy of a file (exactly how the line endings will be modified depends on your Git configuration). I haven't looked at the details, but my hunch is that the reason that you see this warning each time you do dune test is that Dune is probably calling git diff at some point and any Git operation that touches a file may generate the above warning.
When running Cram tests on Windows (from a Linux-based project), I ran into a few issues.
I created a
.t
file and ran the test on Linux, then updated the oracles (with LF as line terminator) to Git.Then, on Windows (Cygwin, to be more precise), I cloned the git and re-ran the test (with
dune test
), and everything seemd fine.However, if I change the
.t
file (e.g. add a new command,$ ls
in the example below) and rundune test
, thegit diff
message contains the entire output, as in:I need to do
dune promote
and thengit diff
to better see the diff:Here, the
^M
clearly shows the issue is the CR added by Windows.The issue is that, by default on a fresh Cygwin,
git config core.autocrlf true
is not set. In this kind of setup, it should be. My question is: is there a reason why the result ofdune promote
does not display the^M
, asgit diff
does? It could help diagnose such issues earlier.I then ran
git config core.autocrlf true
to avoid the issue and obtained the expected diff.Now, the remaining issue is that, if I change the
.t
file again (for instance, to add a new command), whenever I rundune test
, I get this warning:Because the message is related to Dune's sandbox directory, I'm afraid there's not much I can do about it. Or is there some configuration that avoids emitting it? Otherwise, could you please confirm that this warning is indeed harmless?
To reproduce it, I simply did (on a Linux) a
dune init project
, then added atest.t
directory with arun.t
, inside thetest
directory, randune test
,dune promote
, committed it to git, and then, on a Cygwin machine (withgit config core.autocrlf true
set), cloned the project, modifiedrun.t
and re-randune test
.Specifications
dune
(output ofdune --version
): 3.9.1 on both Linux and Windowsocaml
(output ofocamlc --version
): 4.13.1 on Linux, 4.14.0 on WindowsThe text was updated successfully, but these errors were encountered: