Handle missing origin/data when generating fixtures - #50
Open
HansonHe-UW wants to merge 1 commit into
Open
Conversation
In shallow clones (e.g. `gh repo clone -- --depth 1`), or when cloning the public mirror (which does not include the `data` branch), running `./scripts/generate-fixtures.sh` without `FETCH_FIXTURES_FROM` fails with a cryptic `fatal: invalid reference: origin/data` from `git worktree`. Before invoking `git worktree add`, check whether `origin/data` is present locally and try to fetch it on demand. If the ref still cannot be obtained — which is the case for the public mirror — exit with an actionable error pointing the contributor at `FETCH_FIXTURES_FROM`. Fixes WATonomous#49.
HansonHe-UW
force-pushed
the
fix/49-shallow-clone-fixtures
branch
from
May 26, 2026 23:27
bd8efb7 to
cf580f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #49.
When running
npm run generate-fixtures(invoked bynpm run dev,npm run build, andnpm test) in either a shallow clone (gh repo clone -- --depth 1) or any clone of the public mirror, the script previously failed with:This PR makes
scripts/generate-fixtures.shcheck whetherorigin/datais available before callinggit worktree add, attempt to fetch it on demand, and fall back to a clear, actionable error message that points the contributor atFETCH_FIXTURES_FROMwhen the ref isn't reachable.Behavior after change
fatal: invalid reference: origin/dataorigin/data, then worksfatal: invalid reference: origin/dataFETCH_FIXTURES_FROMFETCH_FIXTURES_FROMsetTesting
Verified locally on macOS:
FETCH_FIXTURES_FROM→ exits 1 with the new error message and git's underlyingfatal: couldn't find remote ref datais preserved for debuggability.FETCH_FIXTURES_FROM=https://cloud.watonomous.ca/fixtures→ goes through the unchangedwgetbranch.bash -n scripts/generate-fixtures.shclean.I do not have access to the internal monorepo, so I could not directly exercise the shallow-internal-clone case end-to-end — happy to defer to maintainers on that scenario.
Scope notes
Intentionally kept the change focused. I did not touch
.github/workflows/build.ymlor make the data ref configurable via an env var — happy to extend if maintainers prefer.