-
Notifications
You must be signed in to change notification settings - Fork 350
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
jj fix
uses incorrect paths when executed from a non-root directory.
#4866
Comments
Proposed solution: Set the working directory to the repo root in https://github.com/martinvonz/jj/blob/68b72ad51f5fc2f14cb649adaa428daed3b198e5/cli/src/commands/fix.rs#L391 |
I think this is working as intended. The formatter is supposed to take the input on stdin and produce the output on stdout. The |
Even if it is just metadata, the metadata is incorrect. If I'm in |
We use the full path at Google. Our formatter is a multiplexer. It picks the formatter to delegate to depending on What do you want to use the relative path for? |
Ah, I get what you're saying now. My concern is that it's very easy to do what I accidentally did and just write the tool as I haven't tried this, but I imagine that if I had How would you feel about explicitly creating an empty temporary directory to run the fixes in so that the relative paths don't work, and any attempt to do so would fail gracefully, rather than spectacularly blowing up your commits? |
I just experimented and confirmed that this is exactly what happens |
Don't you need this anyway, because of concurrency? |
You shouldn't need it for a well-behaved fix command, since a well-behaved one only reads from stdin and writes to stdout, which leaves |
@yuja raised a very good point on my PR, pulling it into the discussion here.
This is a very good point which I hadn't considered before, but it also means that it's currently broken under a few specific circumstances.
|
Good points. Sounds like we should set the current directory to the workspace root when running the formatters then. |
Description
Steps to Reproduce the Problem
Add a tool to your config
Expected Behavior
It should be able to fix it
Actual Behavior
Specifications
The text was updated successfully, but these errors were encountered: