Skip to content

Commit 20ef4e9

Browse files
committed
run git config -l in temp dir when looking up system config
Commit a9a3545 made `gix::config::File::from_globals()` try to find the system config (typically `/etc/config`) by subprocessing to `git config -l --show-origin`. That command takes about 500 ms when run in certain directories in our VFS at Google. Since we don't need anything but the system config, let's run the command in the system's temporary directory instead. I also added `--system` for good measure. I've confirmed that just adding `--system` is not enough, however - `git config -l --system --show-origin` is still slow in our VFS.
1 parent 12251eb commit 20ef4e9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use std::env;
12
use std::path::{Path, PathBuf};
23
use std::process::{Command, Stdio};
34

@@ -88,7 +89,8 @@ pub(super) static EXE_INFO: Lazy<Option<BString>> = Lazy::new(|| {
8889
const CREATE_NO_WINDOW: u32 = 0x08000000;
8990
cmd.creation_flags(CREATE_NO_WINDOW);
9091
}
91-
cmd.args(["config", "-l", "--show-origin"])
92+
cmd.args(["config", "-l", "--system", "--show-origin"])
93+
.current_dir(env::temp_dir())
9294
.stdin(Stdio::null())
9395
.stderr(Stdio::null());
9496
cmd

0 commit comments

Comments
 (0)