Repository navigation
Add make-targets that format the lines a branch changed - #728
Merged
Merged
Conversation
Let contributors match the house style with the repository's own .clang-format before a reviewer has to point it out. - Add `make format`, which reformats the lines changed since the branch left gitx/gitx master, uncommitted ones included; `BASE=` overrides the starting point - Add `make format-check`, which shows what would change and fails if anything would - Report unformatted changed lines after every make that builds, the way submodule drift is reported, with a tip to run `make format`; it never fails a build and stays quiet on CI or without clang-format
goneng
marked this pull request as ready for review
September 25, 2026 18:46
hannesa2
approved these changes
Sep 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Let contributors match the house style with the repository's own
.clang-formatbefore a reviewer has to point it out. Only the lines a branch changed are looked at: 34 of the 250 source files inClasses,GitXTestsandGitXUITestsare not formatted that way today, and checking whole files would flag them all.Changes
make formatreformats the lines changed since the branch left master, uncommitted ones included (git clang-format --force <base>). A new file counts once it is added to git.make format-checkshows the diff clang-format would apply and fails if there is one, with a tip to runmake format.build,unit-test,ui-test,all-tests,archive), the unformatted files are listed next to the submodule and framework warnings, with the same tip. It never fails the build, and stays quiet on CI, without clang-format installed, or with no base to measure from.masteron whichever remote points at gitx/gitx, since that remote isoriginin a plain clone and oftenupstreamin a fork.BASE=<commit>overrides it.There is no CI step: the runners have no clang-format, and a different version of it may format the same code another way. That is for a separate discussion.
Test plan
format-checkpasses and nothing is reported; after mangling a line, the build-end warning names the file,format-checkshows the diff and fails, andformatfixes it soformat-checkpasses again.GITHUB_ACTIONSset and without clang-format onPATH(whereformatasks tobrew install clang-format); a clone with no gitx/gitx remote asks forBASE=, and a badBASEfails with git's error..git, and skips forks such asme/gitx.