History

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`.

Eliah Kagan committed 2 years ago

Commit 4e936bc1 parent 8f6d39d1 file · +2 −2Browse files

Unified · Split

gix-path/src/env/git/mod.rs+2−2
@@ -118,8 +118,8 @@ fn git_cmd(executable: PathBuf) -> Command { · 117 unmodified lines
118 // We will try to run `git` from a location fairly high in the filesystem. This can be faster118 // We will try to run `git` from a location fairly high in the filesystem. This can be faster
119 // than running it from our own CWD, if we are deeply nested or on network storage.119 // than running it from our own CWD, if we are deeply nested or on network storage.
120 let cwd = if cfg!(windows) {120 let cwd = if cfg!(windows) {
121 // Use the Windows directory (usually `C:\Windows`) if we can tell what it is. Don't use121 // Try the Windows directory (usually `C:\Windows`) first. It is given by `SystemRoot`,
122 // `C:\`, as limited users can put a `.git` dir there (though up-to-date Git won't use it).122 // except in rare cases where our own parent has not passed down that environment variable.
123 env::var_os("SystemRoot")123 env::var_os("SystemRoot")
124 .or_else(|| env::var_os("windir"))124 .or_else(|| env::var_os("windir"))
125 .map(PathBuf::from)125 .map(PathBuf::from)