#54847: build: skip exporting patches for targets that are not checked out
Requested by John Kleinschmidt · Slack thread
Description of Change
Patch export now skips any target whose repo has no .git entry, in both script/export_all_patches.py (e patches all) and git.export_patches (e patches <target>).
When a dep is gated behind a checkout condition that is off, like src/third_party/fontconfig/src (checkout_linux) on macOS and Windows, gclient leaves an empty directory where the gitlink points. The old check only tested that the path existed, so export ran git inside the empty directory. Git then resolved to the parent Chromium src repo, wrote Chromium's patches into that target's patch dir and deleted its real patches. This matches the apply-side fix in #54741.
I tested this against a local repro: a fake src repo with an unfetched fontconfig gitlink, plus a real fontconfig clone. With the fix, patches/fontconfig stays untouched on the empty checkout, and the chromium and real-fontconfig targets still export the same patches as before.
This needs a backport to 44-x-y. There, the fontconfig target added in #54666 makes e patches all hit this bug on macOS and Windows checkouts.
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, past tense, and no longer than 80 characters.
Release Notes
Notes: none
🤖 Generated with Claude Code
https://claude.ai/code/session_01VtCqxtcRjyqNbTVx5BPteM
Generated by Claude Code
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron