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
`NULL_DEVICE` is `/dev/null` except on Windows, where there are
several possible choices. Previously we were using `NUL` because
the more modern full path `\\.\NUL` is not supported by `git`.
However, `git` also rejects `NUL`, when capitalized, on some
Windows systems. This can be observed on Windows 11 ARM64 builds.
In contrast, the lower-case `nul`, which Windows itself treats the
same as `NUL`, is always accepted by Git for Windows.
Although it's not readily apparent why Git for Windows accepts
`NUL` on some Windows operating systems and/or platforms and not
others, the preferential treatment of `nul` (not extending to
`NUL`) can be seen in a few places in the Git for Windows source
code, including in `mingw_access` (`strcmp` is case-sensitive):
https://github.com/git-for-windows/git/blob/a36f720572491aafc59d63ff926b04d9fa787ec3/compat/mingw.c#L1093
Therefore, this changes `"NUL"` to `"nul"` for the Windows null
device path. This allows some functionality where `git` is invoked
that had been broken on ARM64 Windows systems to start working.
See 7280a2d (GitoxideLabs#1567) and 3cf9fc1 (GitoxideLabs#1570) for further context. Git
for Windows also special-cases the literal path `/dev/null` in
access checks and when opening it for read or write (thought not if
an attempt is made to execute or change directory to it). We
nonetheless change `NUL` to `nul` on Windows, rather than changing
it to `/dev/null` and using that value on all platforms.
The reason is that treating `/dev/null` as the null device on
Windows is specific to Git for Windows. `/dev/null` on Windows
would not be the null device, nor otherwise special, if we open it
ourselves, nor if opened indirectly by other programs that don't
special-case it. Then it would be equivalent to `\dev\null` (a
relative path, resolved as `X:\dev\null` where `X:` is replaced by
the current drive, which is not what we want).
0 commit comments