File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff 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)
You can’t perform that action at this time.
0 commit comments