Skip to content

fix(bench-compare): validate remote git references#19569

Merged
yongkangc merged 6 commits intomainfrom
yk/rbc_pull
Nov 7, 2025
Merged

fix(bench-compare): validate remote git references#19569
yongkangc merged 6 commits intomainfrom
yk/rbc_pull

Conversation

@yongkangc
Copy link
Copy Markdown
Contributor

@yongkangc yongkangc commented Nov 7, 2025

Summary

This should now work without requiring the branch to be checked out locally first.

Problem

The tool was failing with this error when trying to use remote branches:

Error: Git reference 'yk/compute_trie2' does not exist as branch, tag, or commit

Even though git fetch --all successfully fetched the remote branch, the validation step only checked:

  • Local branches (refs/heads/...)
  • Local tags (refs/tags/...)
  • Commits

This meant remote-only branches (like origin/feature-branch) would fail validation.

Solution

Simplified validate_refs() to use git rev-parse --verify {ref} which leverages git's built-in reference resolution - the same logic used by git checkout. This now recognizes:

  • Local branches
  • Remote branches (e.g., origin/feature or just feature)
  • Tags
  • Commit hashes

Previously, `validate_refs()` only checked local branches, tags, and
commits by explicitly specifying ref paths (refs/heads/, refs/tags/).
This caused validation to fail for remote-only branches even after
`git fetch --all` successfully fetched them.

Simplified the validation to use `git rev-parse --verify {ref}` which
leverages git's built-in reference resolution, matching the behavior
of `git checkout`. This allows the tool to recognize:
- Local branches
- Remote branches (e.g., origin/feature-branch)
- Tags
- Commit hashes

Fixes the error: "Git reference 'X' does not exist as branch, tag, or commit"
when using remote branches that haven't been checked out locally.
…h origin/ fallback

Use git rev-parse --verify {ref}^{commit} and fall back to origin/{ref}^{commit} so remote-only branches (e.g. origin/yk/compute_trie2) validate like git checkout DWIM. Keep clear errors showing attempted forms.
…-only branch

Spin up a temporary bare repo and a clone, create a remote-only branch, and verify validate_refs accepts it. Also add a negative test. Use tempfile as a dev-dependency.
@yongkangc yongkangc self-assigned this Nov 7, 2025
Keep the validate_refs DWIM fix; drop the temporary integration tests and the tempfile dev-dep per request.
@yongkangc yongkangc marked this pull request as ready for review November 7, 2025 06:46
@yongkangc yongkangc requested a review from gakonst as a code owner November 7, 2025 06:46
@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Nov 7, 2025
@yongkangc yongkangc added this pull request to the merge queue Nov 7, 2025
Merged via the queue into main with commit 5464312 Nov 7, 2025
42 checks passed
@yongkangc yongkangc deleted the yk/rbc_pull branch November 7, 2025 08:33
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Nov 7, 2025
@jenpaff jenpaff moved this from Done to Completed in Reth Tracker Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

3 participants