mirror of
https://github.com/j178/prek.git
synced 2026-04-03 17:34:03 +02:00
@@ -5,6 +5,6 @@ uv = { max-threads = 1}
|
||||
# due to concurrent uv cache writes.
|
||||
# Configure these tests to run sequentially.
|
||||
[[profile.default.overrides]]
|
||||
filter = 'test(run_basic) | test(local_need_install)'
|
||||
filter = 'binary(run) and test(/run_basic|local_need_install/)'
|
||||
platform = 'cfg(windows)'
|
||||
test-group = 'uv'
|
||||
|
||||
@@ -184,25 +184,27 @@ impl TestContext {
|
||||
.current_dir(&self.temp_dir)
|
||||
.assert()
|
||||
.success();
|
||||
}
|
||||
|
||||
/// Configure git user and email.
|
||||
pub fn configure_git_author(&self) {
|
||||
Command::new("git")
|
||||
.arg("config")
|
||||
.current_dir(&self.temp_dir)
|
||||
.arg("user.name")
|
||||
.arg("Test User")
|
||||
.arg("Pre-Commit Test")
|
||||
.current_dir(&self.temp_dir)
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
Command::new("git")
|
||||
.arg("config")
|
||||
.current_dir(&self.temp_dir)
|
||||
.arg("user.email")
|
||||
.arg("test@example.com")
|
||||
.arg("test@pre-commit-rs.dev")
|
||||
.current_dir(&self.temp_dir)
|
||||
.assert()
|
||||
.success();
|
||||
}
|
||||
|
||||
/// Run `git add` in the temporary directory.
|
||||
/// Run `git add`.
|
||||
pub fn git_add(&self, path: impl AsRef<OsStr>) {
|
||||
Command::new("git")
|
||||
.arg("add")
|
||||
@@ -212,7 +214,7 @@ impl TestContext {
|
||||
.success();
|
||||
}
|
||||
|
||||
/// Run `git commit` in the temporary directory.
|
||||
/// Run `git commit`.
|
||||
pub fn git_commit(&self, message: &str) {
|
||||
Command::new("git")
|
||||
.arg("commit")
|
||||
|
||||
@@ -25,7 +25,7 @@ fn hook_impl() {
|
||||
"});
|
||||
|
||||
context.git_add(".");
|
||||
|
||||
context.configure_git_author();
|
||||
let mut commit = Command::new("git");
|
||||
commit
|
||||
.arg("commit")
|
||||
|
||||
@@ -728,6 +728,7 @@ fn merge_conflicts() -> Result<()> {
|
||||
let cwd = context.workdir();
|
||||
cwd.child("file.txt").write_str("Hello, world!")?;
|
||||
context.git_add(".");
|
||||
context.configure_git_author();
|
||||
context.git_commit("Initial commit");
|
||||
|
||||
Command::new("git")
|
||||
|
||||
Reference in New Issue
Block a user