Skip to content

Commit

Permalink
Merge branch 'master' into struct-patch-upgrade-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yanganto authored Oct 16, 2024
2 parents 9e89250 + 3643e80 commit 5b07b7a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 5 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion asyncgit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ rayon = "1.10"
rayon-core = "1.12"
scopetime = { path = "../scopetime", version = "0.1" }
serde = { version = "1.0", features = ["derive"] }
ssh-key = { version = "0.6.6", features = ["crypto", "encryption"] }
ssh-key = { version = "0.6.7", features = ["crypto", "encryption"] }
thiserror = "1.0"
unicode-truncate = "1.0"
url = "2.5"
Expand Down
35 changes: 35 additions & 0 deletions asyncgit/src/revlog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ mod tests {
use std::time::Duration;

use crossbeam_channel::unbounded;
use serial_test::serial;
use tempfile::TempDir;

use crate::sync::tests::{debug_cmd_print, repo_init};
use crate::sync::RepoPath;
Expand Down Expand Up @@ -368,4 +370,37 @@ mod tests {

assert!(result.is_ok());
}

#[test]
#[serial]
fn test_env_variables() {
let (_td, repo) = repo_init().unwrap();
let git_dir = repo.path();

let (tx_git, _rx_git) = unbounded();

let empty_dir = TempDir::new().unwrap();
let empty_path: RepoPath =
empty_dir.path().to_str().unwrap().into();

let arc_current = Arc::new(Mutex::new(AsyncLogResult {
commits: Vec::new(),
duration: Duration::default(),
}));
let arc_background = Arc::new(AtomicBool::new(false));

std::env::set_var("GIT_DIR", git_dir);

let result = AsyncLog::fetch_helper_without_filter(
// We pass an empty path, thus testing whether `GIT_DIR`, set above, is taken into account.
&empty_path,
&arc_current,
&arc_background,
&tx_git,
);

std::env::remove_var("GIT_DIR");

assert!(result.is_ok());
}
}

0 comments on commit 5b07b7a

Please sign in to comment.