Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjusted hook tests to work on windows #236

Merged
merged 14 commits into from
Aug 18, 2020
16 changes: 6 additions & 10 deletions asyncgit/src/sync/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ fn run_hook(
let output = Command::new("bash")
.args(bash_args)
.current_dir(path)
.env("DUMMYENV", "FixPathHandlingOnWindows") // This call forces Command to handle the Path environment correctly on windows, the specific env set here does not matter
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wtf... this is crazy! 🙈

.output();

let output = output.expect("general hook error");
Expand Down Expand Up @@ -183,8 +184,7 @@ mod tests {
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();

let hook = b"
#!/bin/sh
let hook = b"#!/bin/sh
exit 0
";

Expand All @@ -204,8 +204,7 @@ exit 0
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();

let hook = b"
#!/bin/sh
let hook = b"#!/bin/sh
echo 'msg' > $1
echo 'rejected'
exit 1
Expand All @@ -230,8 +229,7 @@ exit 1
let root = repo.path().parent().unwrap();
// let repo_path = root.as_os_str().to_str().unwrap();

let hook = b"
#!/bin/sh
let hook = b"#!/bin/sh
echo 'msg' > $1
echo 'rejected'
exit 1
Expand Down Expand Up @@ -261,8 +259,7 @@ exit 1
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();

let hook = b"
#!/bin/sh
let hook = b"#!/bin/sh
echo 'msg' > $1
exit 0
";
Expand All @@ -281,8 +278,7 @@ exit 0
let (_td, repo) = repo_init().unwrap();
let root = repo.path().parent().unwrap();

let hook = b"
#!/bin/sh
let hook = b"#!/bin/sh
echo 'rejected'
exit 1
";
Expand Down