make patch # start from the applied state
$EDITOR src/some/file.cc # make your change in the Chromium tree
scripts/build.sh # verify it builds and does what you claim
scripts/patch.sh export privacy/0040-short-description.patchexport writes git diff from src/ into that file and appends it to
patches/series if it isn't listed. Open the file afterwards and:
- Add a header comment: what it changes, why, and which upstream files it will conflict with next time.
- Delete anything unrelated that crept in.
- Move it to the right position in
seriesif order matters.
Then verify it applies from clean:
scripts/patch.sh revert
scripts/patch.sh applyA patch that only applies to your working tree is not a patch.
export captures the whole diff of src/. If you have made two unrelated
changes, export them one at a time: stash the other, export, unstash. Two
concerns in one patch is the most common review rejection.
git checkout -b bump/141.0.7420.42
echo 141.0.7420.42 > CHROMIUM_VERSION
make unpatch
make sync
make patch # stops at the first patch that no longer appliesWhen one fails:
cd src
git apply --3way ../patches/privacy/0030-example.patch # leaves conflict markers
# resolve the conflicts in the affected files
cd ..
scripts/patch.sh export privacy/0030-example.patch # overwrite with the fixed versionThen revert and apply the whole series again from clean, and keep going
until the series applies end to end. Commit the refreshed patches and the
CHROMIUM_VERSION bump together, one commit, with the upstream release notes
linked in the message.
If a patch has been fighting the rebase for three releases running, it is a signal, not bad luck: either the feature belongs upstream as a proper extension point, or it should be reimplemented somewhere more stable. Say so in the PR rather than refreshing it a fourth time.
Delete the file and its line in series. Don't leave commented-out entries —
git remembers, series should only describe the present.
- Anything a GN argument can do. Put it in
build/args/. - Anything a runtime flag can do. Put it in FLAGS.md.
- Formatting.
git diff --staton your patch should be small and boring. - Generated files. Patch the generator, not its output.
- Vendored third-party code. Add it through DEPS, or reconsider.
The questions a reviewer asks, in order:
- Can this be done without patching?
- Does it touch a security boundary? (If yes: it needs a second reviewer.)
- How hard will this be to refresh in three months?
- Is the claim it makes on the website actually true of this code?