fix: clean working tree after issue branch checkout, fixes #151#152
Merged
Conversation
When cloning with git clone --reference, origin/main may be ahead of the issue branch base. git updates the index correctly during checkout but can leave working tree files from those newer main commits behind as modified or untracked, producing a dirty git status. Add git reset --hard HEAD and git clean -fd immediately after the issue branch checkout in both drupal-core and drupal-contrib templates so the working tree exactly matches the checked-out branch. Add a dirty-tree check to both test-issue-branches.sh scripts so this class of regression is caught by the test suite. Update update-drupal-cache to fast-forward the seed local main branch after fetching so git status on the server stays clean. Requires reinstalling: sudo install -m 755 drupal-core/scripts/update-drupal-cache /usr/local/bin/update-drupal-cache Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 statuson Drupal core checkout #151git reset --hard HEAD && git clean -fdin bothdrupal-coreanddrupal-contribtemplates so the working tree exactly matches the branch--reference,origin/mainmay be ahead of the issue branch base; git correctly updates the index but can leave modified/untracked files from those newer main commits in the working treetest-issue-branches.shscripts now check for a dirty tree immediately after issue branch checkout and fail if any modified or untracked files are presentupdate-drupal-cachenow fast-forwards the seed localmainbranch after fetching, keepinggit statusclean on the serverDeployment note
After merging, reinstall
update-drupal-cacheon the production server:Test plan
drupal-coreworkspace with issue fork3589595/3589595-fix-deprecation-versionand verifygit statusis clean after startupbash drupal-core/scripts/test-issue-branches.sh 3589595:3589595-fix-deprecation-version:drupal12locally — should pass the new dirty-tree checkbash drupal-contrib/scripts/test-issue-branches.sh— should pass the new dirty-tree checkupdate-drupal-cacheon the server and verifygit statusin~/cache/drupal-core-seedis clean after the next timer run🤖 Generated with Claude Code