From f9b7c2a14c939d0bb7d1ac2fcca3116e38e37f74 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Sun, 22 Jun 2025 22:57:08 +0200 Subject: 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. --- server/hook/src/githook.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'server/hook/src/githook.rs') 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> { 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> { let data: Vec<&str> = line.split(' ').collect(); if data.len() == 3 { - let mut commiter: Option = 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, }) } } -- cgit v1.2.3-70-g09d2