From 0f3ac3833209cf98956cd5f8887c454c89fecc68 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Mon, 21 Apr 2025 12:02:44 -0600 Subject: [PATCH] Agent eval: Copy `.rules` file into eval worktree for examples based on Zed (#29116) Also reverts #29108, which cherry-picked the rules file for an eval example. Release Notes: - N/A --- .../examples/find_and_replace_diff_card/base.toml | 2 +- crates/eval/src/example.rs | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/eval/examples/find_and_replace_diff_card/base.toml b/crates/eval/examples/find_and_replace_diff_card/base.toml index 9cc9370bc6ca391681d86942d5eeb89f3281a1b4..c88298997d17c8b53aad1a1e73df094788bebf5d 100644 --- a/crates/eval/examples/find_and_replace_diff_card/base.toml +++ b/crates/eval/examples/find_and_replace_diff_card/base.toml @@ -1,3 +1,3 @@ url = "https://github.com/zed-industries/zed.git" -revision = "03ecb88fe30794873f191ddb728f597935b3101c" +revision = "38fcadf9481d018543c65f36ac3bafeba190179b" language_extension = "rs" diff --git a/crates/eval/src/example.rs b/crates/eval/src/example.rs index 058254996fca019ed06abd40b39e8964e383abd6..a82fbecc93b19a06331504fece43642829605ca0 100644 --- a/crates/eval/src/example.rs +++ b/crates/eval/src/example.rs @@ -37,6 +37,8 @@ pub const WORKTREES_DIR: &str = "./crates/eval/worktrees"; const THREAD_EVENT_TIMEOUT: Duration = Duration::from_secs(60 * 2); +const ZED_REPO_URL: &str = "https://github.com/zed-industries/zed.git"; + #[derive(Clone, Debug, Deserialize)] pub struct ExampleBase { pub url: String, @@ -226,6 +228,10 @@ impl Example { .await?; } + if self.base.url == ZED_REPO_URL { + std::fs::write(worktree_path.join(".rules"), std::fs::read(".rules")?)?; + } + std::fs::create_dir_all(self.example_output_directory())?; Ok(()) @@ -637,7 +643,11 @@ impl Example { async fn repository_diff(&self) -> Result { let worktree_path = self.worktree_path(); run_git(&worktree_path, &["add", "."]).await?; - run_git(&worktree_path, &["diff", "--staged"]).await + let mut diff_args = vec!["diff", "--staged"]; + if self.base.url == ZED_REPO_URL { + diff_args.push(":(exclude).rules"); + } + run_git(&worktree_path, &diff_args).await } }