This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new db84cd2e59 tools: add git pre-commit hook based on checkpatch.sh
db84cd2e59 is described below

commit db84cd2e59f2704e609b39f1f0c92f3af3e27254
Author: liuhaitao <liuhai...@xiaomi.com>
AuthorDate: Tue Jan 7 16:00:22 2020 +0800

    tools: add git pre-commit hook based on checkpatch.sh
    
    tools/pre-commit should be copied to .git/hooks/pre-commit to take
    effect.
    
    Signed-off-by: liuhaitao <liuhai...@xiaomi.com>
---
 tools/pre-commit | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/pre-commit b/tools/pre-commit
new file mode 100755
index 0000000000..f9210fc7ce
--- /dev/null
+++ b/tools/pre-commit
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+# tools/pre-commit
+# git hook to run check-patch on the output and stop any commits
+# that do not pass. Note, only for git-commit, and not for any of the
+# other scenarios
+#
+# Copyright 2010 Ben Dooks, <ben-li...@fluff.org>
+
+if git rev-parse --verify HEAD 2>/dev/null >/dev/null
+then
+       against=HEAD
+else
+       # Initial commit: diff against an empty tree object
+       against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+fi
+
+git diff --cached $against -- | ../nuttx/tools/checkpatch.sh -r -

Reply via email to