Commit graph

13 commits

Author SHA1 Message Date
Patryk Obara
5362bab091 Do not rely on OSTYPE in format-commit script
This script should be usable outside of CI machines.
2023-04-07 18:18:51 -07:00
Patryk Obara
e1d2ff94ac Fix reformatting code when manually specifying commits
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
2023-04-07 18:18:51 -07:00
Patryk Obara
96fb0fc6e8 Add --version option to format-commit 2023-04-07 18:18:51 -07:00
kcgen
668dc787d3 Make clang-format add braces
This is specific to clang-format version 15.x and greater, so
this commit also checks for this version in the format-commit
wrapper script.
2022-11-18 00:34:16 -08:00
Kirk
e7fda5a7d1
Update Clang Format to 12.0.0 2022-06-29 18:17:20 -07:00
kcgen
15385f7aca Fix a newly-detected warning by shellcheck 8.x 2022-06-27 14:30:28 -07:00
kcgen
139597fd99 Find and use GNU sed in format-commit 2021-06-03 12:55:40 -07:00
kcgen
c232870c16 Use an array to handle line ranges in format-commit 2021-06-03 12:55:40 -07:00
kcgen
fa50c01a13 Use bash's internal [[ test in format-commit 2021-06-03 12:55:40 -07:00
kcgen
a9d95fd98a Fix a typo if format-commit's version message 2021-06-03 12:55:40 -07:00
Patryk Obara
0a36c37328 Adjust copyright statements for 2021
- 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.
2021-01-01 00:12:05 +01:00
Patryk Obara
68a1291bc6 Update clang-format rules to 9.0
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.
2020-04-02 03:30:17 +02:00
Patryk Obara
0759165f45 Implement script for re-formatting recent commits
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.
2020-04-01 07:38:05 +02:00