From 6dd622d6c329b1a0ff812bed43abcb22fa16f101 Mon Sep 17 00:00:00 2001 From: Oleksiy Syvokon Date: Thu, 17 Apr 2025 19:57:37 +0300 Subject: [PATCH] eval: Fix git revision existence check (#28959) This change fixes a bug in the worktree initialization. Details: `git ref-parse --verify $HASH` just checks that $HASH is a well-formed hash and will successfully return even if $HASH doesn't exist. Release Notes: - N/A --- crates/eval/src/example.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/eval/src/example.rs b/crates/eval/src/example.rs index 0e0a385bcb..0968b62423 100644 --- a/crates/eval/src/example.rs +++ b/crates/eval/src/example.rs @@ -140,9 +140,12 @@ impl Example { pub async fn setup(&mut self) -> Result<()> { let repo_path = repo_path_for_url(&self.base.url); - let revision_exists = run_git(&repo_path, &["rev-parse", "--verify", &self.base.revision]) - .await - .is_ok(); + let revision_exists = run_git( + &repo_path, + &["rev-parse", &format!("{}^{{commit}}", self.base.revision)], + ) + .await + .is_ok(); if !revision_exists { println!(