Skip to content

fix: clean working tree after issue branch checkout, fixes #151#152

Merged
rfay merged 1 commit into
mainfrom
20260511_rfay_clean_git_checkout
May 11, 2026
Merged

fix: clean working tree after issue branch checkout, fixes #151#152
rfay merged 1 commit into
mainfrom
20260511_rfay_clean_git_checkout

Conversation

@rfay
Copy link
Copy Markdown
Member

@rfay rfay commented May 11, 2026

Summary

  • After checking out an issue fork branch, run git reset --hard HEAD && git clean -fd in both drupal-core and drupal-contrib templates so the working tree exactly matches the branch
  • When cloning with --reference, origin/main may 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 tree
  • Both test-issue-branches.sh scripts now check for a dirty tree immediately after issue branch checkout and fail if any modified or untracked files are present
  • update-drupal-cache now fast-forwards the seed local main branch after fetching, keeping git status clean on the server

Deployment note

After merging, reinstall update-drupal-cache on the production server:

sudo install -m 755 drupal-core/scripts/update-drupal-cache /usr/local/bin/update-drupal-cache

Test plan

  • Create a new drupal-core workspace with issue fork 3589595 / 3589595-fix-deprecation-version and verify git status is clean after startup
  • Run bash drupal-core/scripts/test-issue-branches.sh 3589595:3589595-fix-deprecation-version:drupal12 locally — should pass the new dirty-tree check
  • Run bash drupal-contrib/scripts/test-issue-branches.sh — should pass the new dirty-tree check
  • Reinstall update-drupal-cache on the server and verify git status in ~/cache/drupal-core-seed is clean after the next timer run

🤖 Generated with Claude Code

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>
@rfay rfay merged commit c41927f into main May 11, 2026
23 of 24 checks passed
@rfay rfay deleted the 20260511_rfay_clean_git_checkout branch May 11, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant