mirror of
https://github.com/gitui-org/gitui
synced 2026-05-23 17:08:21 +00:00
cleanup
This commit is contained in:
parent
b9ac1865db
commit
d2d69063e3
1 changed files with 16 additions and 30 deletions
|
|
@ -103,6 +103,19 @@ mod tests {
|
|||
assert_eq!(res, HookResult::Ok);
|
||||
}
|
||||
|
||||
fn create_hook(path: &Path, hook_path: &str, hook_script: &[u8]) {
|
||||
File::create(&path.join(hook_path))
|
||||
.unwrap()
|
||||
.write_all(hook_script)
|
||||
.unwrap();
|
||||
|
||||
Command::new("chmod")
|
||||
.args(&["+x", hook_path])
|
||||
.current_dir(path)
|
||||
.output()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(windows))]
|
||||
fn test_hooks_commit_msg_ok() {
|
||||
|
|
@ -115,16 +128,7 @@ mod tests {
|
|||
exit 0
|
||||
";
|
||||
|
||||
File::create(&root.join(HOOK_COMMIT_MSG))
|
||||
.unwrap()
|
||||
.write_all(hook)
|
||||
.unwrap();
|
||||
|
||||
Command::new("chmod")
|
||||
.args(&["+x", HOOK_COMMIT_MSG])
|
||||
.current_dir(root)
|
||||
.output()
|
||||
.unwrap();
|
||||
create_hook(root, HOOK_COMMIT_MSG, hook);
|
||||
|
||||
let mut msg = String::from("test");
|
||||
let res = hooks_commit_msg(repo_path, &mut msg);
|
||||
|
|
@ -148,16 +152,7 @@ echo 'rejected'
|
|||
exit 1
|
||||
";
|
||||
|
||||
File::create(&root.join(HOOK_COMMIT_MSG))
|
||||
.unwrap()
|
||||
.write_all(hook)
|
||||
.unwrap();
|
||||
|
||||
Command::new("chmod")
|
||||
.args(&["+x", HOOK_COMMIT_MSG])
|
||||
.current_dir(root)
|
||||
.output()
|
||||
.unwrap();
|
||||
create_hook(root, HOOK_COMMIT_MSG, hook);
|
||||
|
||||
let mut msg = String::from("test");
|
||||
let res = hooks_commit_msg(repo_path, &mut msg);
|
||||
|
|
@ -183,16 +178,7 @@ echo 'msg' > $1
|
|||
exit 0
|
||||
";
|
||||
|
||||
File::create(&root.join(HOOK_COMMIT_MSG))
|
||||
.unwrap()
|
||||
.write_all(hook)
|
||||
.unwrap();
|
||||
|
||||
Command::new("chmod")
|
||||
.args(&["+x", HOOK_COMMIT_MSG])
|
||||
.current_dir(root)
|
||||
.output()
|
||||
.unwrap();
|
||||
create_hook(root, HOOK_COMMIT_MSG, hook);
|
||||
|
||||
let mut msg = String::from("test");
|
||||
let res = hooks_commit_msg(repo_path, &mut msg);
|
||||
|
|
|
|||
Loading…
Reference in a new issue