When creating a scripted-diff commit, a developer currently needs to:
- Locate and read the Developer Notes on scripted-diffs
- Write a script
- Debug it, possibly over multiple attempts
- Add
scripted-diff:to the beginning of the commit message & PR title - Add the script(s) to the commit body
- Add
-BEGIN VERIFY SCRIPT-and-END VERIFY SCRIPT-around the script
I found copying the above text into the editor during git commit to be a manual and repetitive part of building these commits.
This approach allows a simpler workflow for testing, applying, and committing these scripts. A developer can now:
- Create a working script file, e.g.
0.sh - Run
0.shto apply the changes,git diffto examine them, and perhapsgit checkoutto refresh and retry over multiple attempts. When desired,git addthe changes. - Run
./contrib/devtools/commit-scripted-diff 0.sh "docs: Rename X to x globally"
Improvements that could be made to this script:
- Further input validation
- Run
test/lint/commit-script-check.shagainst the most recent commit(s) - Use
git commit -t <template_file>, which would instead drop the user off in the editor atCOMMIT_EDITMSGwith pre-filled text. We would need to createtemplate_fileon the fly. - ~Add to Developer Notes and Devtools~
- ~Copyright info~
Feedback appreciated; thank you!