From 3890f1a804a3f8b3f952a38fffc6e6bd6034164d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 2 Nov 2022 16:11:44 +0100 Subject: [PATCH] make last test work to allow us to clone properly (#450) --- git-repository/src/clone/fetch/util.rs | 5 +++-- git-repository/tests/clone/mod.rs | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/git-repository/src/clone/fetch/util.rs b/git-repository/src/clone/fetch/util.rs index f52389269c..8e16b90acb 100644 --- a/git-repository/src/clone/fetch/util.rs +++ b/git-repository/src/clone/fetch/util.rs @@ -42,7 +42,7 @@ pub fn replace_changed_local_config_file(repo: &mut Repository, mut config: git_ /// HEAD cannot be written by means of refspec by design, so we have to do it manually here. Also create the pointed-to ref /// if we have to, as it might not have been naturally included in the ref-specs. pub fn update_head( - repo: &Repository, + repo: &mut Repository, remote_refs: &[git_protocol::fetch::Ref], reflog_message: &BStr, remote_name: &str, @@ -161,7 +161,7 @@ pub fn update_head( /// is able to match it. /// For that we reload the remote of `remote_name` and use its ref_specs for match. fn setup_branch_config( - repo: &Repository, + repo: &mut Repository, branch: &FullNameRef, branch_id: Option<&git_hash::oid>, remote_name: &str, @@ -205,6 +205,7 @@ fn setup_branch_config( Some(branch.as_bstr()), ); std::fs::write(config_path, config.to_bstring())?; + replace_changed_local_config_file(repo, config); } Ok(()) } diff --git a/git-repository/tests/clone/mod.rs b/git-repository/tests/clone/mod.rs index 92fddaf963..2fd49a9882 100644 --- a/git-repository/tests/clone/mod.rs +++ b/git-repository/tests/clone/mod.rs @@ -11,7 +11,6 @@ mod blocking_io { use crate::remote; #[test] - #[ignore] fn fetch_only_with_configuration() -> crate::Result { let tmp = git_testtools::tempfile::TempDir::new()?; let called_configure_remote = std::sync::Arc::new(std::sync::atomic::AtomicBool::default()); @@ -145,8 +144,7 @@ mod blocking_io { ); assert_eq!( repo.branch_remote_ref(short_name.as_ref()).expect("present")?.as_bstr(), - remote_name, - "the remote branch information is fully configured" + "refs/heads/main" ); {