Debian Codegraph @

cli/docs/windows.md

raw
1 # Working on Windows
2
3 Jujutsu works the same on all platforms, but there are some caveats that Windows
4 users should be aware of.
5
6 ## Line endings conversion
7
8 Jujutsu has a setting,
9 [`working-copy.eol-conversion`](config.md#eol-conversion-setting), similar to
10 Git's [`core.autocrlf`][git-autocrlf][^1], but does not currently honor
11 `.gitattributes` and the `core.autocrlf` Git config, so it is recommended to
12 keep the `working-copy.eol-conversion` setting and the `core.autocrlf` Git
13 config in sync[^1].
14
15 !!! note
16
17 If you created a colocated workspace and forgot to keep these two settings
18 in sync, resulting in a dirty working copy with only EOL diffs, you can set
19 the `working-copy.eol-conversion` setting correctly and run `jj abandon` to
20 fix it.
21
22 Regardless of this setting, the line endings conversion is skipped on binary
23 files based on a [heuristic](config.md#binary-file-detection). This behavior is
24 subject to change when we support the `text` Git attribute.
25
26 Jujutsu may incorrectly determine whether a file is a binary file and apply line
27 endings conversion incorrectly, but currently, Jujutsu doesn't support per-file
28 configuration of line endings conversion. If this occurs, you can disable line
29 endings conversion by setting the `working-copy.eol-conversion` config to `none`
30 or just removing the config altogether.
31
32 ```powershell
33 PS> git config core.autocrlf input
34 # Use `none` instead of `input` to avoid applying EOL conversion.
35 PS> jj config set --repo working-copy.eol-conversion none
36 # Abandoning the working copy will cause Jujutsu to overwrite all files with
37 # CRLF line endings with the line endings they were committed with, probably LF.
38 PS> jj abandon
39 ```
40
41 This means that line endings will be checked out exactly as they are committed
42 and committed exactly as authored, ensuring Git will check out files with LF
43 line endings without converting them to CRLF. You'll want to make sure any
44 tooling you use, especially IDEs, preserve LF line endings.
45
46 [^1]: This poses the question of whether we should support reading the
47 `core.autocrlf` setting in colocated workspaces. See details at the
48 [issue][read-git-config-issue].
49 [git-autocrlf]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_core_autocrlf
50 [read-git-config-issue]: https://github.com/jj-vcs/jj/issues/4048
51
52 ## Pagination
53
54 On Windows, `jj` will use its integrated pager called `streampager` by default,
55 unless the config `ui.pager` is explicitly set. See the [pager section of the
56 config docs](config.md#pager) for more details.
57
58 If the built-in pager doesn't meet your needs and you have Git installed, you
59 can switch to using Git's pager as follows:
60
61 ```powershell
62 PS> jj config set --user ui.pager '["C:\\Program Files\\Git\\usr\\bin\\less.exe", "-FRX"]'
63 PS> jj config set --user ui.paginate auto
64 ```
65
66 ## Typing `@` in PowerShell
67
68 PowerShell uses `@` as part the [array sub-expression operator][array-op], so it
69 often needs to be escaped or quoted in commands:
70
71 ```powershell
72 PS> jj log -r `@
73 PS> jj log -r '@'
74 ```
75
76 One solution is to create a revset alias. For example, to make `HEAD` an alias
77 for `@`:
78
79 ```powershell
80 PS> jj config set --user revset-aliases.HEAD '@'
81 PS> jj log -r HEAD
82 ```
83
84 ## WSL sets the execute bit on all files
85
86 When viewing a Windows drive from WSL (via _/mnt/c_ or a similar path), Windows
87 exposes all files with the execute bit set. Since Jujutsu automatically records
88 changes to the working copy, this sets the execute bit on all files committed in
89 your repository.
90
91 If you only need to access the repository in WSL, the best solution is to clone
92 the repository in the Linux file system (for example, in
93 `~/my-repo`).
94
95 If you need to use the repository in both WSL and Windows, one solution is to
96 create a workspace in the Linux file system:
97
98 ```powershell
99 PS> jj workspace add --name wsl ~/my-repo
100 ```
101
102 Then only use the `~/my-repo` workspace from Linux.
103
104 [array-op]: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_arrays?view=powershell-7.4#the-array-sub-expression-operator
105
106 ## Symbolic link support
107
108 `jj` supports symlinks on Windows only when they are enabled by the operating
109 system. This requires Windows 10 version 14972 or higher, as well as Developer
110 Mode. If those conditions are not satisfied, `jj` will materialize symlinks as
111 ordinary files.
112
113 For colocated workspaces, Git support must also be enabled using the
114 `git config` option `core.symlinks=true`.