Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
G
GLib
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 925
    • Issues 925
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 53
    • Merge Requests 53
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • GNOME
  • GLib
  • Merge Requests
  • !932

Closed
Opened Jun 19, 2019 by Emmanuel Fleury@emmanuel.fleuryContributor
  • Report abuse
Report abuse

WIP: Clang format git hook

  • Overview 7
  • Commits 1
  • Pipelines 13
  • Changes 1

I am currently playing a bit with clang-format and clang-tidy for my teaching. At some point I stumbled on #1552 (closed) and I wrote this (very little) MR to let you know how easy it is to use it.

Basically, I just add a .clang-format written by @pwithnall (see .clang-format).

Then, I use this git hook (also mentioned in #1552 (closed)) as follow:

#> git clone https://github.com/barisione/clang-format-hooks.git
#> mkdir .git/scripts/
#> cp clang-format-hooks/apply-format .git/scripts/
#> cp clang-format-hooks/git-pre-commit-format .git/scripts/
#> .git/scripts/git-pre-commit-format install
#> rm -fr clang-format-hooks/

And, it works... Nothing more to add.

I am not sure this will be useful to anybody else, but it captures quite a lot of stupid errors I do a lot (forgetting space between function name and the left parenthesis, wrong indent, ...). So, it seems to be extremely useful (at least to me).

Related to issue #1552 (closed)

Edited Jun 20, 2019 by Emmanuel Fleury
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Reference: GNOME/glib!932
Source branch: clang-format_git_hook