From df175f549fd4850caed26e05f17b44498c4fa6f4 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Thu, 13 May 2021 23:00:46 -0700 Subject: [PATCH] working copy: don't assume that $HOME exists (it doesn't on Windows CI) --- lib/src/working_copy.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/src/working_copy.rs b/lib/src/working_copy.rs index bb3d4f3e5..19e338155 100644 --- a/lib/src/working_copy.rs +++ b/lib/src/working_copy.rs @@ -312,11 +312,12 @@ impl TreeState { // library crate instead of depending on $HOME directly here. We should also // have the caller (within the library crate) chain that the // .jj/git/info/exclude file if we're inside a git-backed repo. - let home_dir = std::env::var("HOME"); - let home_dir_path = PathBuf::from(home_dir.unwrap()); let mut git_ignore = GitIgnoreFile::empty(); - git_ignore = - TreeState::try_chain_gitignore(&git_ignore, "", home_dir_path.join(".gitignore")); + if let Ok(home_dir) = std::env::var("HOME") { + let home_dir_path = PathBuf::from(home_dir); + git_ignore = + TreeState::try_chain_gitignore(&git_ignore, "", home_dir_path.join(".gitignore")); + } let mut work = vec![( DirRepoPath::root(),