upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/git.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/git.rs')
-rw-r--r--src/git.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/git.rs b/src/git.rs
index 29670eb..7292508 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -53,6 +53,7 @@ pub trait RepoActions {
53 latest_commit: &Sha1Hash, 53 latest_commit: &Sha1Hash,
54 ) -> Result<(Vec<Sha1Hash>, Vec<Sha1Hash>)>; 54 ) -> Result<(Vec<Sha1Hash>, Vec<Sha1Hash>)>;
55 fn make_patch_from_commit(&self, commit: &Sha1Hash) -> Result<String>; 55 fn make_patch_from_commit(&self, commit: &Sha1Hash) -> Result<String>;
56 fn extract_commit_pgp_signature(&self, commit: &Sha1Hash) -> Result<String>;
56 fn checkout(&self, ref_name: &str) -> Result<Sha1Hash>; 57 fn checkout(&self, ref_name: &str) -> Result<Sha1Hash>;
57 fn create_branch_at_commit(&self, branch_name: &str, commit: &str) -> Result<()>; 58 fn create_branch_at_commit(&self, branch_name: &str, commit: &str) -> Result<()>;
58 fn apply_patch_chain( 59 fn apply_patch_chain(
@@ -225,6 +226,22 @@ impl RepoActions for Repo {
225 .to_owned()) 226 .to_owned())
226 } 227 }
227 228
229 fn extract_commit_pgp_signature(&self, commit: &Sha1Hash) -> Result<String> {
230 let oid = Oid::from_bytes(commit.as_byte_array()).context(format!(
231 "failed to convert commit_id format for {}",
232 &commit
233 ))?;
234
235 let (sign, _data) = self
236 .git_repo
237 .extract_signature(&oid, None)
238 .context("failed to extract signature - perhaps there is no signature?")?;
239
240 Ok(std::str::from_utf8(&sign)
241 .context("commit signature cannot be converted to a utf8 string")?
242 .to_owned())
243 }
244
228 fn get_commits_ahead_behind( 245 fn get_commits_ahead_behind(
229 &self, 246 &self,
230 base_commit: &Sha1Hash, 247 base_commit: &Sha1Hash,