From 2cdbb8c7ac6c98af6e36c4458c08bef2299794e1 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 23 Sep 2024 10:46:26 +0100 Subject: fix(remote): add resilience to `prs` make poorly formatted patches fail silently. we stop trusting that the `commit` tag in the latest patch can be produced by apply the patches. to achieve this we must recreate the commit during the list command, which require fetching the parent oids. support patches without optional `commit` and `parent-commit` tags. --- tests/git_remote_nostr/fetch.rs | 4 +--- tests/git_remote_nostr/list.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'tests/git_remote_nostr') diff --git a/tests/git_remote_nostr/fetch.rs b/tests/git_remote_nostr/fetch.rs index 26d0b5b..17fd6d4 100644 --- a/tests/git_remote_nostr/fetch.rs +++ b/tests/git_remote_nostr/fetch.rs @@ -140,8 +140,7 @@ mod when_first_git_server_fails_ { #[tokio::test] #[serial] async fn creates_commits_from_open_proposal_with_no_warnings_printed() -> Result<()> { - let (events, source_git_repo) = prep_source_repo_and_events_including_proposals().await?; - let source_path = source_git_repo.dir.to_str().unwrap().to_string(); + let (events, _) = prep_source_repo_and_events_including_proposals().await?; let (mut r51, mut r52, mut r53, mut r55, mut r56, mut r57) = ( Relay::new(8051, None, None), @@ -166,7 +165,6 @@ async fn creates_commits_from_open_proposal_with_no_warnings_printed() -> Result let mut p = cli_tester_after_fetch(&git_repo)?; p.send_line(format!("fetch {proposal_tip} refs/heads/{branch_name}").as_str())?; p.send_line("")?; - p.expect(format!("fetching {source_path} over filesystem...\r\n").as_str())?; // expect no errors p.expect_after_whitespace("\r\n")?; p.exit()?; diff --git a/tests/git_remote_nostr/list.rs b/tests/git_remote_nostr/list.rs index d173cc7..37cff30 100644 --- a/tests/git_remote_nostr/list.rs +++ b/tests/git_remote_nostr/list.rs @@ -52,6 +52,10 @@ mod without_state_announcement { assert_eq!( res.split("\r\n") .map(|e| e.to_string()) + .filter(|s| !s.contains("remote: ") + && !s.contains("Receiving objects") + && !s.contains("Resolving deltas") + && !s.contains("fetching /")) .collect::>(), HashSet::from([ "@refs/heads/main HEAD".to_string(), @@ -220,6 +224,10 @@ mod with_state_announcement { assert_eq!( res.split("\r\n") .map(|e| e.to_string()) + .filter(|s| !s.contains("remote: ") + && !s.contains("Receiving objects") + && !s.contains("Resolving deltas") + && !s.contains("fetching /")) .collect::>(), HashSet::from([ "@refs/heads/main HEAD".to_string(), -- cgit v1.2.3