You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/08/14 11:06:15 UTC

[incubator-nuttx-apps] branch master updated: tools: add git pre-commit hook for apps

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

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new dbb19c9e5 tools: add git pre-commit hook for apps
dbb19c9e5 is described below

commit dbb19c9e5aaf955b42d0c6fae8279c4d958ec3a5
Author: liuhaitao <li...@xiaomi.com>
AuthorDate: Thu Apr 2 16:06:59 2020 +0800

    tools: add git pre-commit hook for apps
    
    VELAPLATFO-1028
    
    tools/pre-commit should be copied to .git/hooks/pre-commit to take
    effect.
    
    Signed-off-by: liuhaitao <li...@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 000000000..f9210fc7c
--- /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, <be...@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 -