Harness the power of signify(1) to sign arbitrary git objects
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

push/pull

+62
+14
src/main.rs
··· 1 1 mod fingerprint; 2 + mod pull; 3 + mod push; 2 4 mod raw; 3 5 mod sign; 4 6 mod utils; ··· 47 49 /// The signed git revision to verify 48 50 git_rev: String, 49 51 }, 52 + /// Push signify data to a remote repository 53 + Push { 54 + /// The name of the remote repository 55 + remote: String, 56 + }, 57 + /// Pull signify data from a remote repository 58 + Pull { 59 + /// The name of the remote repository 60 + remote: String, 61 + }, 50 62 } 51 63 52 64 #[derive(Subcommand)] ··· 97 109 public_key, 98 110 git_rev: rev, 99 111 } => verify::command(public_key, rev), 112 + Action::Push { remote } => push::command(remote), 113 + Action::Pull { remote } => pull::command(remote), 100 114 } 101 115 }
+24
src/pull.rs
··· 1 + //! Pull data from a remote repo. 2 + 3 + use std::process::Command; 4 + 5 + use anyhow::{anyhow, Context, Result}; 6 + 7 + use crate::utils::ALL_SIGNIFY_REFS; 8 + 9 + /// Execute the `pull` command. 10 + pub fn command(remote: String) -> Result<()> { 11 + let exit_code = Command::new("git") 12 + .arg("fetch") 13 + .arg(remote) 14 + .arg(format!("{ALL_SIGNIFY_REFS}:{ALL_SIGNIFY_REFS}")) 15 + .spawn() 16 + .context("Failed to spawn git command")? 17 + .wait() 18 + .context("Failed to wait for git command")?; 19 + if exit_code.success() { 20 + Ok(()) 21 + } else { 22 + Err(anyhow!("Exit code of git: {exit_code}")) 23 + } 24 + }
+24
src/push.rs
··· 1 + //! Push data to a remote repo. 2 + 3 + use std::process::Command; 4 + 5 + use anyhow::{anyhow, Context, Result}; 6 + 7 + use crate::utils::ALL_SIGNIFY_REFS; 8 + 9 + /// Execute the `push` command. 10 + pub fn command(remote: String) -> Result<()> { 11 + let exit_code = Command::new("git") 12 + .arg("push") 13 + .arg(remote) 14 + .arg(ALL_SIGNIFY_REFS) 15 + .spawn() 16 + .context("Failed to spawn git command")? 17 + .wait() 18 + .context("Failed to wait for git command")?; 19 + if exit_code.success() { 20 + Ok(()) 21 + } else { 22 + Err(anyhow!("Exit code of git: {exit_code}")) 23 + } 24 + }