Contrib script to accurately update copyright headers

SlowRiot requested to merge SlowRiot/bitcoin-cash-node:copyright_headers into master

There is already a script to update or insert copyright headers in the correct format -

This is a contrib script intended as a helper wrapping around the existing script, intended to allow the script to work on the entire source directory with accurate dates.


Contrib script contrib/devtools/

The script works in the following way:

  1. It runs on the source tree in update mode
  2. It processes the output to find files that do not have an existing line to update
  3. It filters those files to remove the third party libraries and auto-generated files
  4. It runs again on the identified files in insert mode
  5. It reports insertions, or no-changes, in the same format as

Usage: contrib/devtools/

Changes to contrib/devtools/

The existing script has been modified to only find changes since the fork commit, 964a185cc83af34587194a6ecda3ed9cf6b49263, so it will not erroneously add new copyright lines for "the bitcoin developers" in duplicate, for changes made in Core before the fork and already marked "the bitcoin core developers".

Output has also had an over-exuberant exclamation mark removed.

Example results:




Future work

A separate MR has been raised to actually update the copyright notices: !1550 (merged)

Test plan


Examine the git diffs to verify the changes look acceptable. Spot check several files with git log to confirm the newly updated and inserted copyright periods are correct.

Edited by SlowRiot

Merge request reports