Repository navigation
link-fixtures: fetch before moving to master, and refuse to discard local work - #683
Merged
Merged
Conversation
The script was `git clone … || git -C ../jikan-fixtures reset --hard origin/master`: no fetch, so an existing clone could stay on a month-old ref and disagree with CI about which recordings exist, and the hard reset destroyed uncommitted recordings and snapshots silently. A small PHP script now fetches, checks out master, fast-forwards, and refuses to touch a clone that has uncommitted changes. PHP is used rather than a shell script so the Windows CI runners run it too.
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.
Two bugs in one line of
composer.json:"git clone … || git -C ../jikan-fixtures reset --hard origin/master"origin/master, so the local recordings could disagree with what CI installs. That happened for real: a local clone sat on a month-old ref and on a feature branch, which made a baseline run look different from CI for no code reason.reset --harddestroys uncommitted work. Any recording or snapshot in progress is silently discarded — the failure mode is invisible until you notice the files are gone.The fix
scripts/link-fixtures.php, called as the first step of the composer script:../jikan-fixturesis absent;fetch --prune origin,checkout master,merge --ff-only origin/master;PHP rather than a shell script because
tests.yamlrunscomposer run-script link-fixturesonwindows-latesttoo, whereshis not guaranteed to be on PATH.Verification
link-fixtures: ../jikan-fixtures is on master at 7dfcc70(was stale, now sits on current master).link-fixtures: ../jikan-fixtures has uncommitted changes; commit or stash them first.and exit 1.composer link-fixturesend-to-end: fetches, symlinksvendor/jikan-me/jikan-fixtures,composer updateresolves the new reference.No behaviour change for a fresh checkout; the difference is only that an existing one is brought up to date safely.