summaryrefslogtreecommitdiff
path: root/server/src/git_root.rs
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2025-01-29 00:34:30 +0100
committerJoel Klinghed <the_jk@spawned.biz>2025-01-29 00:34:30 +0100
commit05b674190f26e2a58cc7b7288586c031552d50f3 (patch)
tree452035e852a7012061c9424a9dc0f56fcad129ee /server/src/git_root.rs
parent145b93302cbb7cb090c90fd07ed4ebabf742e453 (diff)
Add git-server to docker-compose
To make a githook that can run on alpine images (using musl) they need to be cross-compiled. Then it became apparent that the githook binary was pulling in all the same dependencies as the server was. This is not good, but apparently also not something Rust/Cargo has figured out. RFC:s has been shutdown. workspace might be an option but then I probably need to also add a "code shared by both githook and server" library that both can link. Problem for another day.
Diffstat (limited to 'server/src/git_root.rs')
-rw-r--r--server/src/git_root.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/server/src/git_root.rs b/server/src/git_root.rs
index 4da8f43..31e4d45 100644
--- a/server/src/git_root.rs
+++ b/server/src/git_root.rs
@@ -25,6 +25,7 @@ type DbConnection = <DbPool as Pool>::Connection;
#[derive(Debug, Deserialize)]
pub struct Config<'a> {
git_server_root: Cow<'a, str>,
+ git_hook: Cow<'a, str>,
}
struct RootsData {
@@ -396,11 +397,13 @@ async fn setup_project_root(
) -> Result<Arc<git::Repository>, git::Error> {
let mut path = PathBuf::from(config.git_server_root.to_string());
path.push(project_id);
+ let githook = PathBuf::from(config.git_hook.to_string());
let repo = Arc::new(git::Repository::new(
path,
true,
Some(remote),
Some(project_id),
+ Some(githook),
));
repo.setup().await?;