-
Notifications
You must be signed in to change notification settings - Fork 1.5k
clang‐format updates
https://github.com/XRPLF/rippled/pull/5157
For branches using clang-format versions prior to 18, it is necessary to make changes to update for clang-format-18.
Instructions:
- confirm the commit sha with changes in
.clang-format
settings
$ git log develop --oneline --graph
. . .
* decb3c178e Update clang-format settings
. . .
- cherry pick this one commit on your branch (with signature)
$ git cherry-pick decb3c178e -S
- confirm the instruction (from
develop
) to reformat the sources files
$ git show develop:.github/workflows/clang-format.yml | grep find | head -1
run: find include src -type f \( -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.ipp' \) -exec clang-format-${CLANG_VERSION} -i {} +
- make sure your
clang-format
is version 18.1.3 (and only this version; e.g. 18.1.6 will reformat the sources differently)
$ clang-format --version
Ubuntu clang-format version 18.1.3 (1ubuntu1)
- reformat source files in your branch with clang-format 18.1.3 and updated settings $ find include src -type f ( -name '.cpp' -o -name '.hpp' -o -name '.h' -o -name '.ipp' ) -exec clang-format -i {} +
- commit new formatting (with signature) $ git commit -m "Reformat code with clang-format-18" -S -i include/ src/
- actually merge develop into your branch, should be easy $ git merge --no-ff develop -S 4 replies
Mayukha Vadari :spiral_calendar_pad: Today at 7:24 AM If you have the pre-commit hook on your machine, I believe pre-commit run --all-files will also do the trick :tada: 1
Bronek Kozicki Today at 7:26 AM I think in this case you need to bring both .clang-format and .pre-commit-config.yaml from develop branch first
Mayukha Vadari :spiral_calendar_pad: Today at 7:27 AM True, that command would be after merging/rebasing on top of develop :+1::skin-tone-2: 1
Bronek Kozicki Today at 7:34 AM but then merging can be potentially a little tricky, if you do not reformat your sources first. Which is why this instruction.
credit to Bronek.