Skip to content

Commit 4e936bc

Browse files
committed
Fix misstatement of Windows directory rationale
+ Make clear that `SystemRoot` really is intended to give this, as readers unfamiliar with that variable may erroneously confuse it with `SystemDrive` or otherwise assume it would give a path like `C:\` rather than `C:\Windows`.
1 parent 8f6d39d commit 4e936bc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gix-path/src/env/git/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ fn git_cmd(executable: PathBuf) -> Command {
118118
// We will try to run `git` from a location fairly high in the filesystem. This can be faster
119119
// than running it from our own CWD, if we are deeply nested or on network storage.
120120
let cwd = if cfg!(windows) {
121-
// Use the Windows directory (usually `C:\Windows`) if we can tell what it is. Don't use
122-
// `C:\`, as limited users can put a `.git` dir there (though up-to-date Git won't use it).
121+
// Try the Windows directory (usually `C:\Windows`) first. It is given by `SystemRoot`,
122+
// except in rare cases where our own parent has not passed down that environment variable.
123123
env::var_os("SystemRoot")
124124
.or_else(|| env::var_os("windir"))
125125
.map(PathBuf::from)

0 commit comments

Comments
 (0)