feat(drupal-core): switch cache seed to bare repo, fetch via remote#154
Merged
Conversation
The previous --reference clone approach used a non-bare cache with a working tree. When the working tree drifted from the fetched objects, git clone could populate the workspace with files at old timestamps that git reset --hard HEAD failed to clean up reliably. Replace with a fetch-based approach: - git init + git remote add drupalcache (bare) - git fetch drupalcache (fast local copy of all objects, no working tree) - git remote remove drupalcache - git fetch origin (delta only — new commits since cache was last refreshed) - git fetch issue (issue fork delta, if applicable) - git checkout -b main --track origin/main This guarantees a fresh working tree every time and eliminates the pre-existing-file problem entirely. Non-bare caches (legacy) still work via the --reference fallback path. update-drupal-cache now detects bare repos and skips the unnecessary git merge --ff-only step (bare repos have no working tree to update). Non-bare repos still get the merge for backward compatibility. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pass the bare seed path on staging-coder.ddev.com as cache_path so CI workspaces exercise the bare-remote fetch path in template.tf. Previously tests used /tmp/ci-no-cache (nonexistent) and fell through to the no-cache branch, never testing the cache code path. Also adds a "git tree is clean" assertion to the issue-fork job to catch dirty-checkout regressions (the original bug in #151). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15e9e3f to
5cf6777
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.
Summary
git clone --referenceapproach with a fetch-based workflow using a bare git repo as the cache seedgit init+ fetch from bare cache (fast, local) +git remote remove drupalcache+ fetch delta from origin + fetch issue fork if applicable + checkout--referencecaused (Inappropriate changed files shown ingit statuson Drupal core checkout #151)update-drupal-cachescript to usegit clone --barefor initial setup and adds migration instructionsdocs/admin/server-setup.mdwith bare-repo setup and migration stepsWhy the old approach was broken:
git clone --referenceborrows objects from a local reference repo viainfo/alternates. When the cache was a non-bare working-tree clone, files could have pre-existing timestamps and states that survived into the workspace, causing dirty git trees. The bare approach gives every workspace a clean object store with no working-tree state from the cache.Backward compat: Non-bare cache seeds still work (legacy path preserved). No-cache path is unchanged.
Test plan
update-drupal-cacheruns correctly on both coder.ddev.com and staging-coder.ddev.com🤖 Generated with Claude Code