Skip to content

Commit 4693725

Browse files
committed
README: mention how to develop on (pure) Windows
The highly recommended paved path for developing this site on Windows is to use the Windows Subsystem for Linux. The reason for that is that Windows' filename restrictions prevent Hugo from accommodating the URLs containing URL-encoded question marks that git-scm.com has for historical reasons. However, I understand that there _are_ circumstances under which it might be necessary to develop this site in pure Windows, without the help of Linux. Let's describe what it takes to do that. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 9c3f0e4 commit 4693725

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ $ git sparse-checkout set layouts content static assets hugo.yml data script
2626
$ git reset --hard
2727
```
2828

29+
> [!NOTE]
30+
> On Windows, if you cannot use [Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/wsl/) for some reason, you will be unable to build the site as-is. The reason is that some URLs of the git-scm.com site contain question marks, for historical reasons. These question marks are obviously encoded as `%3F` in the URLs, but the way Hugo works, they are literal question marks in the filenames of the corresponding files. Such filenames are accommodated easily by Linux filesystems, but on Windows, filenames containing question marks are forbidden. For that reason, to build the site on Windows, the following command needs to be run (assuming a Bash, as the rest of this document):
31+
>
32+
> ```sh
33+
> for file in $(find -name \*.html -exec grep -l '^url: .*?' {} \;)
34+
> do
35+
> git update-index --assume-unchanged "$file" &&
36+
> sed -i '/^url: /s/?//g' "$file" ||
37+
> break
38+
> done
39+
> ```
40+
>
41+
> This edits the affected files' `url` front-matter attributes to avoid writing those files containing question marks. Obviously, the result does not support the backwards-compatible URLs that contain URL-encoded question marks.
42+
2943
> [!NOTE]
3044
> If you _already_ have a full clone and wish to accelerate development by focusing only on a small subset of the pages, you may want to run the `git sparse-checkout set [...]` command mentioned above.
3145
@@ -109,7 +123,7 @@ Believe it or not, https://git-scm.com/ has its own test suite. It uses [Playwri
109123
> Building the site, letting Pagefind generate the search index, and then running the test suite can be quite time consuming. To accelerate the development cycle, it is _highly_ recommended to use a sparse checkout instead of a full clone. The minimal sparse checkout required to run the test suite can be configured like this:
110124
>
111125
> ```console
112-
> $ git config set --worktree core.sparseCheckoutCone false
126+
> $ MSYS_NO_PATHCONV=1 git config set --worktree core.sparseCheckoutCone false
113127
> $ git config set --worktree core.sparseCheckout true
114128
> $ git sparse-checkout set \
115129
> /README.md \
@@ -144,6 +158,8 @@ Believe it or not, https://git-scm.com/ has its own test suite. It uses [Playwri
144158
> /tests/git-scm.spec.js
145159
> ```
146160
>
161+
> On Windows, unless you're doing all this in WSL, do not forget to run the commands mentioned earlier to edit the `url` front-matter attributes that contain question marks!
162+
>
147163
> The site can then be built quickly via these commands:
148164
>
149165
> ```console

0 commit comments

Comments
 (0)