diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-31 15:59:17 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-07-31 15:59:17 +0100 |
| commit | 3acdeabfc3ab55d3e92d76d92d8ab6ad0383dd09 (patch) | |
| tree | b5abbca08ec004d31569db9166c37166c39baef2 /src/repo_state.rs | |
| parent | 46116e561fb62ad939c53e937461f2346022565d (diff) | |
feat(remote): `push` issues state event
if no previous state events can be found it replicates git server
otherwise it just updates pushed value
Diffstat (limited to 'src/repo_state.rs')
| -rw-r--r-- | src/repo_state.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/repo_state.rs b/src/repo_state.rs index 33bc90f..0c1aa30 100644 --- a/src/repo_state.rs +++ b/src/repo_state.rs | |||
| @@ -2,6 +2,7 @@ use anyhow::{Context, Result}; | |||
| 2 | use git2::Oid; | 2 | use git2::Oid; |
| 3 | 3 | ||
| 4 | pub struct RepoState { | 4 | pub struct RepoState { |
| 5 | pub identifier: String, | ||
| 5 | pub state: Vec<(String, String)>, | 6 | pub state: Vec<(String, String)>, |
| 6 | pub event: nostr::Event, | 7 | pub event: nostr::Event, |
| 7 | } | 8 | } |
| @@ -26,6 +27,10 @@ impl RepoState { | |||
| 26 | } | 27 | } |
| 27 | } | 28 | } |
| 28 | Ok(RepoState { | 29 | Ok(RepoState { |
| 30 | identifier: event | ||
| 31 | .identifier() | ||
| 32 | .context("existing event must have an identifier")? | ||
| 33 | .to_string(), | ||
| 29 | state, | 34 | state, |
| 30 | event: event.clone(), | 35 | event: event.clone(), |
| 31 | }) | 36 | }) |