From 06c31461d74b10ed6fa01498fd9e2e390ad5395c Mon Sep 17 00:00:00 2001 From: Justin Wernick Date: Fri, 14 Jul 2023 13:32:20 +0200 Subject: Add cleaning up stale objects to the housekeeping task --- tests/cli.rs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'tests/cli.rs') diff --git a/tests/cli.rs b/tests/cli.rs index 598152b..01c3347 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -296,15 +296,22 @@ fn git_housekeeping_repacks_objects() -> Result<()> { } #[test] -#[ignore] fn git_housekeeping_cleans_out_stale_refs() -> Result<()> { - // create a repo - // create a local clone - // make branch b, with commit b - // push it to the repo - // delete branch b on the remote - // check that commit b is still accessible by hash on the remote - // run housekeeping - // check that commit b isn't in the repo anymore + let mut c = TestContext::new_interactive()?; + let repo_path = personal_repo_path(REPO_NAME); + let repo_dir = c.personal_repo_dir(REPO_NAME); + + c.p.send_line(&format!("init {}", REPO_NAME))?; + c.expect_successful_init_message(&repo_path)?; + + let checkout_dir = create_clone(&c, &repo_dir, REPO_NAME); + let commit_hash = create_commit(&checkout_dir)?; + push(&checkout_dir, "main:temporary-branch"); + push(&checkout_dir, ":temporary-branch"); + + verify_commit_exists(&repo_dir, &commit_hash); + c.p.send_line(&format!("housekeeping"))?; + c.p.exp_string(&format!("Successfully did housekeeping on \"{repo_path}\""))?; + verify_commit_does_not_exist(&repo_dir, &commit_hash); Ok(()) } -- cgit v1.2.3