From c9eb34aa69fb07f41b176eaf448557cd41996bfa Mon Sep 17 00:00:00 2001 From: qwjyh Date: Sat, 4 May 2024 14:55:00 +0900 Subject: [PATCH] fix test to fetch refspecs from the git2 --- tests/cli.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/cli.rs b/tests/cli.rs index 4b2ff14..3bf833f 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -151,12 +151,13 @@ mod integrated_test { let upstream_name = "remote"; let mut repo_1_remote = 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()); println!("{:?}", bare_repo_dir.read_dir()?); // set up upstream branch 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 let config_dir_2 = assert_fs::TempDir::new()?; @@ -225,12 +226,12 @@ mod integrated_test { let upstream_name = "remote"; let mut repo_1_remote = 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()); println!("{:?}", bare_repo_dir.read_dir()?); // set up upstream branch 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 let config_dir_2 = assert_fs::TempDir::new()?;