blob: 84f8034cf6afa5dcecc226a8f685bd6813516751 [file] [log] [blame]
Minos Galanakis7eb0fba2021-06-29 15:41:18 +01001#########
2Git Hooks
3#########
4
5This directory is aimed at providing **code snippets** which can be inserted
6to developer's git hooks, and allow them to run the Static Check Framework
7before pushing a patch.
8
9For full description and capabilities, please refer to the official
10documentation for `Git SCM Hooks`_ .
11
12*************
13Adding a hook
14*************
15
16To use a specific hook, please manually copy the snippet to the file with
17matching name, located at
18
19.. code-block:: bash
20
21 TF-M-ROOT/.git/hooks/{HOOK_FILENAME}
22
23
24********
25Pre-Push
26********
27
28Enabling SCF requires adding the snippet on the pre-push hook. This is so that
29the check can be performed **BEFORE** a developer pushes a new patch to Gerrit
30and *ONLY IF* requested by the user.
31
32With the aim of making the functionality unintrusive, the
33following environment variables are required.
34
35- `SCF_ORG`: To set the Organisation for the purposes of Header/Copyright check.
36- `SCF_ENABLE`: To enable checking before pushing a patch.
37
38_If not set SCF_ORG defaults to 'arm'_
39
40**********************
41Custom directory paths
42**********************
43
44By default the reference code assumes the standard directory structure for
45TF-M and dependencies.
46
Elena Uziunaiteb90a3402023-11-13 16:24:28 +000047.. code-block:: console
48
Minos Galanakis7eb0fba2021-06-29 15:41:18 +010049 └── dev-dir
50 ├── tf-m
51 ├── tf-m-tools
52
53The user can override this by setting the `TFM_ROOT_PATH`, `SCF_TEST_PATH`,
54`SCF_TEST_APP` environment variables, to match his needs.
55
56*********
57Using SCP
58*********
59
60Assuming the developer has already set-up trusted-firmware-m and tf-m-tools
61and has already copied the snippet over to `<TF-M-ROOT>/.git/hooks/pre-push`
62
63.. code-block:: bash
64
65 cd <TF-M-ROOT>
66 env SCF_ENABLE=1 git push origin HEAD:refs/for/master
67
68
69.. _Git SCM Hooks: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks
70
71*Copyright (c) 2021, Arm Limited. All rights reserved.*
72*SPDX-License-Identifier: BSD-3-Clause*