Skip to content
Closed
75 changes: 72 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ base64 = "0.22.1"
chrono = "0.4.40"
clap = { version = "4.5.36", features = ["derive"] }
console = "0.15.11"
directories = "6.0.0"
fuzzy-matcher = "0.3.7"
fxhash = "0.2.1"
image = "0.25.6"
Expand Down
14 changes: 9 additions & 5 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn load() -> Result<(UiConfig, GraphConfig, Option<KeyBind>)> {
read_config_from_path(&user_path)
}
None => {
let default_path = xdg_config_file_path();
let default_path = config_file_path();
if default_path.exists() {
read_config_from_path(&default_path)
} else {
Expand All @@ -38,10 +38,14 @@ fn config_file_path_from_env() -> Option<PathBuf> {
env::var(CONFIG_FILE_ENV_NAME).ok().map(PathBuf::from)
}

fn xdg_config_file_path() -> PathBuf {
xdg::BaseDirectories::with_prefix(APP_DIR_NAME)
.unwrap()
.get_config_file(CONFIG_FILE_NAME)
fn config_file_path() -> PathBuf {
use directories::BaseDirs;

BaseDirs::new()
.expect("Couldn't get the base user directories!")
.config_dir()
.join(APP_DIR_NAME)
.join(CONFIG_FILE_NAME)
}

fn read_config_from_path(path: &Path) -> Result<Config> {
Expand Down
3 changes: 2 additions & 1 deletion tests/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,8 @@ impl GitRepository<'_> {
.env("GIT_COMMITTER_EMAIL", "committer@example.com")
.env("GIT_COMMITTER_DATE", datetime_str)
.env("GIT_CONFIG_NOSYSTEM", "true")
.env("HOME", "/dev/null")
.env("GIT_CONFIG_GLOBAL", "/dev/null")
// .env("HOME", "/dev/null")
.output()
.unwrap_or_else(|_| panic!("failed to execute git {}", args.join(" ")));
println!("git {}: returned {}", args.join(" "), out.status,);
Expand Down