diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-08-20 12:32:26 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-08-20 12:32:26 +0100 |
| commit | 09bf648d4a36bc9ada0cff9438aa3b3f98631600 (patch) | |
| tree | d72dac1f6e7fe7945b25e5dace3455966d2431a2 /src/git_remote_helper.rs | |
| parent | 09ead86c82f773778b984b5bbbd9798155265cd3 (diff) | |
fix:(remote): only maintainers can push
and update / issue a state event.
normal users can only push branches prefiex with pr/
and these go on nostr, not the git server.
Diffstat (limited to 'src/git_remote_helper.rs')
| -rw-r--r-- | src/git_remote_helper.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/git_remote_helper.rs b/src/git_remote_helper.rs index 2019bd2..99eea78 100644 --- a/src/git_remote_helper.rs +++ b/src/git_remote_helper.rs | |||
| @@ -655,6 +655,21 @@ async fn push( | |||
| 655 | ) | 655 | ) |
| 656 | .await?; | 656 | .await?; |
| 657 | 657 | ||
| 658 | if !repo_ref.maintainers.contains(&user_ref.public_key) { | ||
| 659 | for refspec in &git_server_refspecs { | ||
| 660 | let (_, to) = refspec_to_from_to(refspec).unwrap(); | ||
| 661 | println!( | ||
| 662 | "error {to} your nostr account {} isn't listed as a maintainer of the repo", | ||
| 663 | user_ref.metadata.name | ||
| 664 | ); | ||
| 665 | } | ||
| 666 | git_server_refspecs.clear(); | ||
| 667 | if proposal_refspecs.is_empty() { | ||
| 668 | println!(); | ||
| 669 | return Ok(()); | ||
| 670 | } | ||
| 671 | } | ||
| 672 | |||
| 658 | if !git_server_refspecs.is_empty() { | 673 | if !git_server_refspecs.is_empty() { |
| 659 | let new_state = generate_updated_state(git_repo, &existing_state, &git_server_refspecs)?; | 674 | let new_state = generate_updated_state(git_repo, &existing_state, &git_server_refspecs)?; |
| 660 | 675 | ||