diff options
| -rw-r--r-- | src/bin/git_remote_nostr/push.rs | 3 | ||||
| -rw-r--r-- | tests/git_remote_nostr/main.rs | 4 | ||||
| -rw-r--r-- | tests/git_remote_nostr/push.rs | 21 |
3 files changed, 18 insertions, 10 deletions
diff --git a/src/bin/git_remote_nostr/push.rs b/src/bin/git_remote_nostr/push.rs index 05c9197..5bc1cc8 100644 --- a/src/bin/git_remote_nostr/push.rs +++ b/src/bin/git_remote_nostr/push.rs | |||
| @@ -296,14 +296,15 @@ pub async fn run_push( | |||
| 296 | // TODO check whether tip of each branch pushed is on at least one git server | 296 | // TODO check whether tip of each branch pushed is on at least one git server |
| 297 | // before broadcasting the nostr state | 297 | // before broadcasting the nostr state |
| 298 | if !events.is_empty() { | 298 | if !events.is_empty() { |
| 299 | term.write_line("broadcast to nostr relays:")?; | ||
| 299 | send_events( | 300 | send_events( |
| 300 | client, | 301 | client, |
| 301 | git_repo.get_path()?, | 302 | git_repo.get_path()?, |
| 302 | events, | 303 | events, |
| 303 | user_ref.relays.write(), | 304 | user_ref.relays.write(), |
| 304 | repo_ref.relays.clone(), | 305 | repo_ref.relays.clone(), |
| 305 | false, | ||
| 306 | true, | 306 | true, |
| 307 | false, | ||
| 307 | ) | 308 | ) |
| 308 | .await?; | 309 | .await?; |
| 309 | } | 310 | } |
diff --git a/tests/git_remote_nostr/main.rs b/tests/git_remote_nostr/main.rs index d05f045..5d2dcbb 100644 --- a/tests/git_remote_nostr/main.rs +++ b/tests/git_remote_nostr/main.rs | |||
| @@ -132,7 +132,9 @@ async fn generate_repo_with_state_event() -> Result<(nostr::Event, GitTestRepo)> | |||
| 132 | let mut p = cli_tester_after_nostr_fetch_and_sent_list_for_push_responds(&git_repo)?; | 132 | let mut p = cli_tester_after_nostr_fetch_and_sent_list_for_push_responds(&git_repo)?; |
| 133 | p.send_line("push refs/heads/main:refs/heads/main")?; | 133 | p.send_line("push refs/heads/main:refs/heads/main")?; |
| 134 | p.send_line("")?; | 134 | p.send_line("")?; |
| 135 | p.expect("ok refs/heads/main\r\n")?; | 135 | |
| 136 | p.expect_eventually("ok ")?; | ||
| 137 | p.expect("refs/heads/main\r\n")?; | ||
| 136 | p.expect_eventually("\r\n\r\n")?; | 138 | p.expect_eventually("\r\n\r\n")?; |
| 137 | p.exit()?; | 139 | p.exit()?; |
| 138 | for p in [51, 52, 53, 55, 56, 57] { | 140 | for p in [51, 52, 53, 55, 56, 57] { |
diff --git a/tests/git_remote_nostr/push.rs b/tests/git_remote_nostr/push.rs index 8a75f37..79e6c01 100644 --- a/tests/git_remote_nostr/push.rs +++ b/tests/git_remote_nostr/push.rs | |||
| @@ -215,7 +215,8 @@ mod two_branches_in_batch_one_added_one_updated { | |||
| 215 | p.send_line("push refs/heads/main:refs/heads/main")?; | 215 | p.send_line("push refs/heads/main:refs/heads/main")?; |
| 216 | p.send_line("push refs/heads/vnext:refs/heads/vnext")?; | 216 | p.send_line("push refs/heads/vnext:refs/heads/vnext")?; |
| 217 | p.send_line("")?; | 217 | p.send_line("")?; |
| 218 | p.expect("ok refs/heads/main\r\n")?; | 218 | p.expect_eventually("ok ")?; |
| 219 | p.expect("refs/heads/main\r\n")?; | ||
| 219 | p.expect("ok refs/heads/vnext\r\n")?; | 220 | p.expect("ok refs/heads/vnext\r\n")?; |
| 220 | p.expect_eventually("\r\n\r\n")?; | 221 | p.expect_eventually("\r\n\r\n")?; |
| 221 | p.exit()?; | 222 | p.exit()?; |
| @@ -626,7 +627,8 @@ mod delete_one_branch { | |||
| 626 | let mut p = cli_tester_after_nostr_fetch_and_sent_list_for_push_responds(&git_repo)?; | 627 | let mut p = cli_tester_after_nostr_fetch_and_sent_list_for_push_responds(&git_repo)?; |
| 627 | p.send_line("push :refs/heads/vnext")?; | 628 | p.send_line("push :refs/heads/vnext")?; |
| 628 | p.send_line("")?; | 629 | p.send_line("")?; |
| 629 | p.expect("ok refs/heads/vnext\r\n")?; | 630 | p.expect_eventually("ok ")?; |
| 631 | p.expect("refs/heads/vnext\r\n")?; | ||
| 630 | p.expect_eventually("\r\n\r\n")?; | 632 | p.expect_eventually("\r\n\r\n")?; |
| 631 | p.exit()?; | 633 | p.exit()?; |
| 632 | for p in [51, 52, 53, 55, 56, 57] { | 634 | for p in [51, 52, 53, 55, 56, 57] { |
| @@ -684,7 +686,8 @@ mod delete_one_branch { | |||
| 684 | cli_tester_after_nostr_fetch_and_sent_list_for_push_responds(&git_repo)?; | 686 | cli_tester_after_nostr_fetch_and_sent_list_for_push_responds(&git_repo)?; |
| 685 | p.send_line("push :refs/heads/example-branch")?; | 687 | p.send_line("push :refs/heads/example-branch")?; |
| 686 | p.send_line("")?; | 688 | p.send_line("")?; |
| 687 | p.expect("ok refs/heads/example-branch\r\n")?; | 689 | p.expect_eventually("ok ")?; |
| 690 | p.expect("refs/heads/example-branch\r\n")?; | ||
| 688 | p.expect_eventually("\r\n\r\n")?; | 691 | p.expect_eventually("\r\n\r\n")?; |
| 689 | p.exit()?; | 692 | p.exit()?; |
| 690 | for p in [51, 52, 53, 55, 56, 57] { | 693 | for p in [51, 52, 53, 55, 56, 57] { |
| @@ -770,7 +773,8 @@ mod delete_one_branch { | |||
| 770 | cli_tester_after_nostr_fetch_and_sent_list_for_push_responds(&git_repo)?; | 773 | cli_tester_after_nostr_fetch_and_sent_list_for_push_responds(&git_repo)?; |
| 771 | p.send_line("push :refs/heads/example-branch")?; | 774 | p.send_line("push :refs/heads/example-branch")?; |
| 772 | p.send_line("")?; | 775 | p.send_line("")?; |
| 773 | p.expect("ok refs/heads/example-branch\r\n")?; | 776 | p.expect_eventually("ok ")?; |
| 777 | p.expect("refs/heads/example-branch\r\n")?; | ||
| 774 | p.expect_eventually("\r\n")?; | 778 | p.expect_eventually("\r\n")?; |
| 775 | p.exit()?; | 779 | p.exit()?; |
| 776 | for p in [51, 52, 53, 55, 56, 57] { | 780 | for p in [51, 52, 53, 55, 56, 57] { |
| @@ -854,7 +858,8 @@ async fn pushes_to_all_git_servers_listed_and_ok_printed() -> Result<()> { | |||
| 854 | let mut p = cli_tester_after_nostr_fetch_and_sent_list_for_push_responds(&git_repo)?; | 858 | let mut p = cli_tester_after_nostr_fetch_and_sent_list_for_push_responds(&git_repo)?; |
| 855 | p.send_line("push refs/heads/main:refs/heads/main")?; | 859 | p.send_line("push refs/heads/main:refs/heads/main")?; |
| 856 | p.send_line("")?; | 860 | p.send_line("")?; |
| 857 | p.expect("ok refs/heads/main\r\n")?; | 861 | p.expect_eventually("ok ")?; |
| 862 | p.expect("refs/heads/main\r\n")?; | ||
| 858 | p.expect_eventually("\r\n\r\n")?; | 863 | p.expect_eventually("\r\n\r\n")?; |
| 859 | p.exit()?; | 864 | p.exit()?; |
| 860 | for p in [51, 52, 53, 55, 56, 57] { | 865 | for p in [51, 52, 53, 55, 56, 57] { |
| @@ -1075,7 +1080,7 @@ async fn push_2_commits_to_existing_proposal() -> Result<()> { | |||
| 1075 | cli_expect_nostr_fetch(&mut p)?; | 1080 | cli_expect_nostr_fetch(&mut p)?; |
| 1076 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; | 1081 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; |
| 1077 | p.expect("list: connecting...\r\n\r\r\r")?; | 1082 | p.expect("list: connecting...\r\n\r\r\r")?; |
| 1078 | p.expect(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; | 1083 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; |
| 1079 | let output = p.expect_end_eventually()?; | 1084 | let output = p.expect_end_eventually()?; |
| 1080 | 1085 | ||
| 1081 | for p in [51, 52, 53, 55, 56, 57] { | 1086 | for p in [51, 52, 53, 55, 56, 57] { |
| @@ -1230,7 +1235,7 @@ async fn force_push_creates_proposal_revision() -> Result<()> { | |||
| 1230 | cli_expect_nostr_fetch(&mut p)?; | 1235 | cli_expect_nostr_fetch(&mut p)?; |
| 1231 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; | 1236 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; |
| 1232 | p.expect("list: connecting...\r\n")?; | 1237 | p.expect("list: connecting...\r\n")?; |
| 1233 | p.expect_after_whitespace(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; | 1238 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; |
| 1234 | let output = p.expect_end_eventually()?; | 1239 | let output = p.expect_end_eventually()?; |
| 1235 | 1240 | ||
| 1236 | for p in [51, 52, 53, 55, 56, 57] { | 1241 | for p in [51, 52, 53, 55, 56, 57] { |
| @@ -1380,7 +1385,7 @@ async fn push_new_pr_branch_creates_proposal() -> Result<()> { | |||
| 1380 | cli_expect_nostr_fetch(&mut p)?; | 1385 | cli_expect_nostr_fetch(&mut p)?; |
| 1381 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; | 1386 | p.expect(format!("fetching {} ref list over filesystem...\r\n", source_path).as_str())?; |
| 1382 | p.expect("list: connecting...\r\n\r\r\r")?; | 1387 | p.expect("list: connecting...\r\n\r\r\r")?; |
| 1383 | p.expect(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; | 1388 | p.expect_eventually_and_print(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; |
| 1384 | let output = p.expect_end_eventually()?; | 1389 | let output = p.expect_end_eventually()?; |
| 1385 | 1390 | ||
| 1386 | for p in [51, 52, 53, 55, 56, 57] { | 1391 | for p in [51, 52, 53, 55, 56, 57] { |