diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-06-22 22:57:08 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-06-22 22:57:08 +0200 |
| commit | f9b7c2a14c939d0bb7d1ac2fcca3116e38e37f74 (patch) | |
| tree | cc20775f2d70416ef6414d265b7e1d44cce6fece /server/hook/src | |
| parent | 9cb8a56b406c46244e936c2f40830d0e89dba785 (diff) | |
Add support for pushing changes to a translation review
Finally got around to fixing the pre-receive hook to include quarantined
objects so the hook actually can run git commands on the not-yet-accepted
commits. As part of that, had to make sure git hook and eyeballs server
had the same path to the repo or confusion will appear.
Diffstat (limited to 'server/hook/src')
| -rw-r--r-- | server/hook/src/githook.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/server/hook/src/githook.rs b/server/hook/src/githook.rs index 3a27e2c..0897dfc 100644 --- a/server/hook/src/githook.rs +++ b/server/hook/src/githook.rs @@ -1,5 +1,6 @@ use rmp_serde::{decode, Serializer}; use serde::ser::Serialize; +use std::env; use std::error::Error; use std::fmt; use std::os::unix::net::UnixStream; @@ -49,6 +50,8 @@ async fn main() -> Result<(), Box<dyn Error>> { let mut request = git_socket::GitHookRequest { pre, receive: Vec::new(), + object_dir: env::var("GIT_OBJECT_DIRECTORY").ok(), + alt_object_dirs: env::var("GIT_ALTERNATE_OBJECT_DIRECTORIES").ok(), }; let repo = git::Repository::new( @@ -64,18 +67,10 @@ async fn main() -> Result<(), Box<dyn Error>> { let data: Vec<&str> = line.split(' ').collect(); if data.len() == 3 { - let mut commiter: Option<String> = None; - if pre && data[1] != git::EMPTY { - if let Ok(user) = repo.get_commiter(data[1]).await { - commiter = Some(user.username); - } - } - request.receive.push(git_socket::GitReceive { old_value: data[0].to_string(), new_value: data[1].to_string(), reference: data[2].to_string(), - commiter, }) } } |
