fix test to fetch refspecs from the git2

This commit is contained in:
qwjyh 2024-05-04 14:55:00 +09:00
parent 4fcb7fc354
commit c9eb34aa69

View file

@ -151,12 +151,13 @@ mod integrated_test {
let upstream_name = "remote"; let upstream_name = "remote";
let mut repo_1_remote = let mut repo_1_remote =
repo_1.remote(upstream_name, bare_repo_dir.path().to_str().unwrap())?; repo_1.remote(upstream_name, bare_repo_dir.path().to_str().unwrap())?;
repo_1_remote.push(&["refs/heads/main"], None)?; repo_1_remote.push(&[repo_1.head().unwrap().name().unwrap()] as &[&str], None)?;
trace!("bare repo {:?}", bare_repo_dir.display()); trace!("bare repo {:?}", bare_repo_dir.display());
println!("{:?}", bare_repo_dir.read_dir()?); println!("{:?}", bare_repo_dir.read_dir()?);
// set up upstream branch // set up upstream branch
let (mut repo_1_branch, _branch_type) = repo_1.branches(None)?.next().unwrap()?; let (mut repo_1_branch, _branch_type) = repo_1.branches(None)?.next().unwrap()?;
repo_1_branch.set_upstream(Some(format!("{}/{}", upstream_name, "main").as_str()))?; println!("head {}", repo_1.head().unwrap().name().unwrap());
repo_1_branch.set_upstream(Some(format!("{}/{}", upstream_name, repo_1_branch.name().unwrap().unwrap()).as_str()))?;
// 2nd device // 2nd device
let config_dir_2 = assert_fs::TempDir::new()?; let config_dir_2 = assert_fs::TempDir::new()?;
@ -225,12 +226,12 @@ mod integrated_test {
let upstream_name = "remote"; let upstream_name = "remote";
let mut repo_1_remote = let mut repo_1_remote =
repo_1.remote(upstream_name, bare_repo_dir.path().to_str().unwrap())?; repo_1.remote(upstream_name, bare_repo_dir.path().to_str().unwrap())?;
repo_1_remote.push(&["refs/heads/main"], None)?; repo_1_remote.push(&[repo_1.head().unwrap().name().unwrap()], None)?;
trace!("bare repo {:?}", bare_repo_dir.display()); trace!("bare repo {:?}", bare_repo_dir.display());
println!("{:?}", bare_repo_dir.read_dir()?); println!("{:?}", bare_repo_dir.read_dir()?);
// set up upstream branch // set up upstream branch
let (mut repo_1_branch, _branch_type) = repo_1.branches(None)?.next().unwrap()?; let (mut repo_1_branch, _branch_type) = repo_1.branches(None)?.next().unwrap()?;
repo_1_branch.set_upstream(Some(format!("{}/{}", upstream_name, "main").as_str()))?; repo_1_branch.set_upstream(Some(format!("{}/{}", upstream_name, repo_1_branch.name().unwrap().unwrap()).as_str()))?;
// 2nd device // 2nd device
let config_dir_2 = assert_fs::TempDir::new()?; let config_dir_2 = assert_fs::TempDir::new()?;