Skip to content

Commit b827813

Browse files
committed
Simplify the new comments
+ Get rid of some nearby comments, moving the essential information into the new ones.
1 parent 7fa5e35 commit b827813

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,12 @@ fn git_cmd(executable: PathBuf) -> Command {
116116
cmd.creation_flags(CREATE_NO_WINDOW);
117117
}
118118
// We will try to run `git` from a location fairly high in the filesystem. This can be faster
119-
// than running it from our CWD, if we are deeply nested or on network storage. We try to pick
120-
// a place that exists, is unlikely to be a repo, and forbids unprivileged users from putting a
121-
// `.git` dir or other entries inside (so not `C:\` on Windows). But we will also be setting
122-
// `GIT_DIR` to a location `git` can't read config from, so this is mostly for performance.
119+
// than running it from our own CWD, if we are deeply nested or on network storage.
123120
let cwd = if cfg!(windows) {
124-
env::var_os("SystemRoot") // Usually `C:\Windows`. Not to be confused with `C:\`.
125-
.or_else(|| env::var_os("windir")) // Same. In case our parent filtered out SystemRoot.
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).
123+
env::var_os("SystemRoot")
124+
.or_else(|| env::var_os("windir"))
126125
.map(PathBuf::from)
127126
.filter(|p| p.is_absolute())
128127
.unwrap_or_else(env::temp_dir)

0 commit comments

Comments
 (0)