mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-20 03:20:08 +00:00
Canonicalize cwd
in CommandHelper::new()
`workspace_root` is [canonicalized](41a2855b4f/lib/src/workspace.rs (L119)
), but `cwd` [isn't](41a2855b4f/src/cli_util.rs (L581)
). When [working with relative paths](41a2855b4f/src/cli_util.rs (L749-L760)
), this leads to issues in Windows: canonicalized paths start with `\\?\`, whereas non-canonicalized paths do not. Therefore, paths were formatted canonicalized, and commands did not accept non-canonicalized paths: ``` $ jj st Parent commit: bdb62c9 canonicalize cwd in cli_util.rs Working copy : 059c104379cd (no description set) Working copy changes: A \\?\C:\github.com\71\jj\.vscode\launch.json $ jj diff .vscode\launch.json Error: Path ".vscode\launch.json" is not in the repo $ jj diff \\?\C:\github.com\71\jj\.vscode\launch.json Added regular file \\?\C:\github.com\71\jj\.vscode\launch.json: ... ``` With this change: ``` $ jj st Parent commit: bdb62c9 canonicalize cwd in cli_util.rs Working copy : 059c104379cd (no description set) Working copy changes: A .vscode\launch.json $ jj diff .vscode\launch.json Added regular file .vscode\launch.json: ... ```
This commit is contained in:
parent
fe653f430e
commit
b08e508ee5
1 changed files with 4 additions and 0 deletions
|
@ -377,6 +377,10 @@ impl CommandHelper {
|
|||
maybe_workspace_loader: Result<WorkspaceLoader, CommandError>,
|
||||
store_factories: StoreFactories,
|
||||
) -> Self {
|
||||
// `cwd` is canonicalized for consistency with `Workspace::workspace_root()` and
|
||||
// to easily compute relative paths between them.
|
||||
let cwd = cwd.canonicalize().unwrap_or(cwd);
|
||||
|
||||
Self {
|
||||
app,
|
||||
cwd,
|
||||
|
|
Loading…
Reference in a new issue