The code was written in a way to process files touched by commits since
specified commit, but then relied on "HEAD~1" string when detecting
ranges of modified lines. In result:
./format-commit.sh HEAD~3
Was re-formatting the newest commit and not detecting any changes in
older commits.
Bump version to 1.0.1
- Update DOSBox Staging Team copyright span to year 2021 (DOSBox Team
copyrights left untouched).
- Add DOSBox Staging Team copyright line to files we extensively
modified throughout 2020 (we add our copyright lines when number of
non-trivially modified lines gets close to 50%).
- Change "dosbox-staging team" to "DOSBox Staging Team", in line with
updated branding.
- Change MAME license identifiers to SPDX license identifiers.
- Cleanup some excessive whitespace around copyright statements.
- Do few adjustments to include order.
- Add few missing copyright identifiers (GPL-2.0-or-later,
LGPL-2.1-or-later, BSD-3-Clause) as appropriate for specific file.
- Move SPDX identifiers to the top in scripts for consistency with other
source files.
- Remove old copy of GPL2 license in italian from old translations.
Set AllowAllConstructorInitializersOnNextLine to false. This prevents
formatting problem when initializer list is long enough to be wrapped
once, but all initializers fitted into the next line.
Turn on AlignConsecutiveMacros option.
This script is intended to be used in two situations:
- When user can't configure clang-format in code editor or IDE
- Potentially to be used in CI in the future
Normal usecase is to run this script after commit, then review and
add formatted code, and amend the commit, e.g.:
git commit -m "Edit some C++ code"
./scripts/format-commit.sh
git add -p # select formatting changes you want to use
git commit --amend
Run:
./scripts/format-commit.sh --help
to learn about other options.