diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-08-18 08:14:29 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-08-18 08:14:29 +0100 |
| commit | de89a7ec528fa57702199f94e63b42f827bd2fdf (patch) | |
| tree | 88c4e0a861d45793f42cbecd5966dac63f2068e5 | |
| parent | 948c8595acea9a783a38002371c40185868ce923 (diff) | |
feat(remote): `push` log merge event creation
so the user knows that a merge commit event will be issued
| -rw-r--r-- | src/git_remote_helper.rs | 11 | ||||
| -rw-r--r-- | tests/git_remote_helper.rs | 4 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/git_remote_helper.rs b/src/git_remote_helper.rs index a03c6cf..cb13e8c 100644 --- a/src/git_remote_helper.rs +++ b/src/git_remote_helper.rs | |||
| @@ -715,6 +715,7 @@ async fn push( | |||
| 715 | events.push(new_repo_state.event); | 715 | events.push(new_repo_state.event); |
| 716 | 716 | ||
| 717 | for event in get_merged_status_events( | 717 | for event in get_merged_status_events( |
| 718 | &term, | ||
| 718 | repo_ref, | 719 | repo_ref, |
| 719 | git_repo, | 720 | git_repo, |
| 720 | nostr_remote_url, | 721 | nostr_remote_url, |
| @@ -1128,6 +1129,7 @@ fn generate_updated_state( | |||
| 1128 | } | 1129 | } |
| 1129 | 1130 | ||
| 1130 | async fn get_merged_status_events( | 1131 | async fn get_merged_status_events( |
| 1132 | term: &console::Term, | ||
| 1131 | repo_ref: &RepoRef, | 1133 | repo_ref: &RepoRef, |
| 1132 | git_repo: &Repo, | 1134 | git_repo: &Repo, |
| 1133 | remote_nostr_url: &str, | 1135 | remote_nostr_url: &str, |
| @@ -1171,7 +1173,14 @@ async fn get_merged_status_events( | |||
| 1171 | let (proposal_id, revision_id) = | 1173 | let (proposal_id, revision_id) = |
| 1172 | get_proposal_and_revision_root_from_patch(git_repo, commit_event) | 1174 | get_proposal_and_revision_root_from_patch(git_repo, commit_event) |
| 1173 | .await?; | 1175 | .await?; |
| 1174 | // TODO: write to terminal to tell user | 1176 | term.write_line( |
| 1177 | format!( | ||
| 1178 | "merge commit {}: create nostr proposal status event", | ||
| 1179 | &commit.id().to_string()[..7], | ||
| 1180 | ) | ||
| 1181 | .as_str(), | ||
| 1182 | )?; | ||
| 1183 | |||
| 1175 | events.push( | 1184 | events.push( |
| 1176 | create_merge_status( | 1185 | create_merge_status( |
| 1177 | signer, | 1186 | signer, |
diff --git a/tests/git_remote_helper.rs b/tests/git_remote_helper.rs index 98637e8..cce8e42 100644 --- a/tests/git_remote_helper.rs +++ b/tests/git_remote_helper.rs | |||
| @@ -1753,6 +1753,10 @@ mod push { | |||
| 1753 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); | 1753 | let mut p = CliTester::new_git_with_remote_helper_from_dir(&git_repo.dir, ["push"]); |
| 1754 | cli_expect_nostr_fetch(&mut p)?; | 1754 | cli_expect_nostr_fetch(&mut p)?; |
| 1755 | p.expect(format!("fetching refs list: {}...\r\n\r", source_path).as_str())?; | 1755 | p.expect(format!("fetching refs list: {}...\r\n\r", source_path).as_str())?; |
| 1756 | |||
| 1757 | p.expect("merge commit ")?; | ||
| 1758 | // shorthand merge commit id appears in this gap | ||
| 1759 | p.expect_eventually(": create nostr proposal status event\r\n")?; | ||
| 1756 | p.expect(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; | 1760 | p.expect(format!("To {}\r\n", get_nostr_remote_url()?).as_str())?; |
| 1757 | let output = p.expect_end_eventually()?; | 1761 | let output = p.expect_end_eventually()?; |
| 1758 | 1762 | ||