Commit

Author:

Hash:

Timestamp:

+12 -11 +/-2 browse

Kevin Schoon [me@kevinschoon.com]

22b9159660545e6ada7738026ea3b978f8b4eb18

Tue, 05 Aug 2025 15:16:24 +0000 (1.1 years ago)

force base_dir if specified in config
1diff --git a/ayllu-shell/src/main.rs b/ayllu-shell/src/main.rs
2index 7812a44..3919b03 100644
3--- a/ayllu-shell/src/main.rs
4+++ b/ayllu-shell/src/main.rs
5 @@ -58,13 +58,14 @@ fn execute(args: Arguments) -> Result<(), Box<dyn std::error::Error>> {
6 .iter()
7 .find(|identity| identity.username == username);
8 match args.command {
9- Some(Commands::GitReceivePack { ref path }) => {
10- let resolved = if path.is_relative() {
11- if let Some(base_dir) = config.base_dir {
12- &base_dir.join(path)
13+ Some(Commands::GitReceivePack { path }) => {
14+ let resolved = if let Some(base_dir) = config.base_dir {
15+ let trimmed = if path.is_absolute() {
16+ path.strip_prefix("/").unwrap()
17 } else {
18- path
19- }
20+ path.as_path()
21+ };
22+ base_dir.join(trimmed)
23 } else {
24 path
25 };
26 @@ -75,10 +76,10 @@ fn execute(args: Arguments) -> Result<(), Box<dyn std::error::Error>> {
27 {
28 Some(_) => {
29 let repository =
30- if ayllu_git::git_dir(resolved).is_ok_and(|is_git_dir| is_git_dir) {
31- Wrapper::new(resolved)?
32+ if ayllu_git::git_dir(&resolved).is_ok_and(|is_git_dir| is_git_dir) {
33+ Wrapper::new(&resolved)?
34 } else {
35- Wrapper::create(resolved, true)?
36+ Wrapper::create(&resolved, true)?
37 };
38 repository.receive_pack()?;
39 }
40 diff --git a/crates/git/src/wrapper.rs b/crates/git/src/wrapper.rs
41index ec7ffa4..480a542 100644
42--- a/crates/git/src/wrapper.rs
43+++ b/crates/git/src/wrapper.rs
44 @@ -990,7 +990,7 @@ impl Wrapper {
45 pub fn receive_pack(&self) -> Result<(), Error> {
46 let repository_path = Path::new(&self.path);
47 let mut command = std::process::Command::new("git");
48- command.args(["receive-pack", &repository_path.to_str().unwrap()]);
49+ command.args(["receive-pack", &repository_path.to_string_lossy()]);
50 command.stdin(Stdio::inherit());
51 command.stdout(Stdio::inherit());
52 let mut child = command.spawn()?;
53 @@ -1002,7 +1002,7 @@ impl Wrapper {
54 pub fn upload_pack(&self) -> Result<(), Error> {
55 let repository_path = Path::new(&self.path);
56 let mut command = std::process::Command::new("git");
57- command.args(["upload-pack", &repository_path.to_str().unwrap()]);
58+ command.args(["upload-pack", &repository_path.to_string_lossy()]);
59 command.stdin(Stdio::inherit());
60 command.stdout(Stdio::inherit());
61 let mut child = command.spawn()?;