[PATCH hwc v1] drm_hwcomposer: Add CONTRIBUTING file
Eric Engestrom
eric.engestrom at imgtec.com
Thu Sep 28 10:43:03 UTC 2017
On Wednesday, 2017-09-27 18:55:49 +0000, Robert Foss wrote:
> > > +- When submitting new code please follow the naming conventions
> > > documented
> > > + in the generated documentation. Also please make full use of all
> > > the helpers and
> > > + convenience macros provided by drm_hwcomposer. The below command
> > > can help you
> > > + with formatting of your patches:
> > > + git diff | clang-format-diff-3.5 -p 1 -style=file
> > > +
> >
> > One could wire that in the pre-merge hook on the server side.
> > It should be quite lightweight, although I'm not sure about the
> > integration with FDO's Debian(?) setup ;-)
>
> Yeah, me neither. Maybe asking Daniel Stone about how this should be
> done is the next step.
>
The package `clang-format-3.5` would need to be installed, but other than
that the integration would be rather trivial; just add this to the
`update` hook:
format_diff=$(git diff -U0 $oldrev..$newrev | clang-format-diff-3.5 -p1)
if [ -n "$format_diff" ]; then
echo 'Code is not formatted properly; please apply this change and try again:'
printf -- '----8<----\n%s\n---->8----\n' "$format_diff"
exit 1
fi
Note that if malformatted commits are to be rejected, it might be best
to have a pre-commit hook on each client (will need manual setup on each
clone) to re-format the code before being committed and therefore before
being sent to ML, to avoid patchwork losing track of reformatted patches.
Alternatively, such patches could be accepted with just a warning being
printed when pushing, but there's a good chance such warnings would just
end up being ignored.
More information about the dri-devel
mailing list