Running checkpatch.pl automatically while doing git commit

Here is how to provide the output of “git diff –cached” to checkpatch script in a single command:

$ git diff –cached | ./scritps/checkpatch.pl –

The same can be added to .git/hooks/pre-commit (also change the file mode to 755), so that even if the checkpatch’ing was forgotten, there is no need to worry

Any commit that violates the coding standard as checked by checkpatch.pl will be aborted.

To forcefully commit the change, “–no-verify” can be added to the commit command.

Source: http://blog.vmsplice.net/2011/03/how-to-automatically-run-checkpatchpl.html

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s