scripts: Add convenience script for committing scripted-diffs from a file #16797

pull ch4ot1c wants to merge 1 commits into bitcoin:master from ch4ot1c:scripts/commit-script changing 4 files +45 −7
  1. ch4ot1c commented at 7:45 PM on September 3, 2019: contributor

    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.sh to apply the changes, git diff to examine them, and perhaps git checkout to refresh and retry over multiple attempts. When desired, git add the 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.sh against the most recent commit(s)
    • Use git commit -t <template_file>, which would instead drop the user off in the editor at COMMIT_EDITMSG with pre-filled text. We would need to create template_file on the fly.
    • ~Add to Developer Notes and Devtools~
    • ~Copyright info~

    Feedback appreciated; thank you!

  2. fanquake added the label Scripts and tools on Sep 3, 2019
  3. daniel-farina commented at 8:26 AM on September 7, 2019: none

    Great idea @ch4ot1c

  4. ch4ot1c commented at 7:58 PM on September 7, 2019: contributor

    Thanks. There are some complexities - like these scripts being run on Ubuntu (on Travis), whether or not to use shebang in the file, and the fact that scripted-diffs are run in a subshell.

  5. laanwj commented at 2:34 PM on September 13, 2019: member

    Concept ACK suggestions:

    • add documentation to contrib/devtools/README.md on using this
    • refer to the script in the developer notes in the section about scripted diffs
  6. scripts: Add convenience script for committing scripted-diffs from a file
    doc: Add to developer notes scripted-diff section
    
    doc: Add /*.sh to .gitignore
    cab2d83e1e
  7. ch4ot1c force-pushed on Sep 17, 2019
  8. ch4ot1c commented at 12:49 PM on September 17, 2019: contributor

    @laanwj Addressed.

  9. DrahtBot commented at 1:53 AM on September 18, 2019: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    No conflicts as of last run.

  10. ch4ot1c commented at 9:48 PM on October 17, 2019: contributor

    Doesn't seem to be much interest; closing.

  11. ch4ot1c closed this on Oct 17, 2019

  12. PastaPastaPasta commented at 5:20 PM on October 21, 2019: contributor

    I personally like this change and would like to see it merged. I think it provides a lot of value for no downside

  13. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 12:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me