[ovs-dev] [PATCH ovn] committer-responsibilities.rst: Add pre-push hook.
hzhou at ovn.org
Thu Oct 7 16:55:46 UTC 2021
Copied from the same document in OVS repo and changed the branch name
Signed-off-by: Han Zhou <hzhou at ovn.org>
.../internals/committer-responsibilities.rst | 50 +++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/Documentation/internals/committer-responsibilities.rst b/Documentation/internals/committer-responsibilities.rst
index 6e5619243..1280076ad 100644
@@ -94,3 +94,53 @@ Use Reported-by: and Tested-by: tags in commit messages to indicate the
source of a bug report.
Keep the ``AUTHORS.rst`` file up to date.
+The following script can be helpful because it provides an extra
+chance to check for mistakes while pushing to the main branch.
+If you would like to use it, install it as ``hooks/pre-push``
+in your ``.git`` directory and make sure to mark it as executable with
+``chmod +x``. For maximum utility, make sure ``checkpatch.py`` is in
+.. code-block:: bash
+ #! /bin/bash
+ case $remote in
+ ovs|ovn|origin) ;;
+ *) exit 0 ;;
+ while read local_ref local_sha1 remote_ref remote_sha1; do
+ case $remote_ref in
+ while read sha
+ n=$(expr $n + 1)
+ git log -1 $sha
+ checkpatch.py -1 $sha
+ done <<EOF
+ $(git --no-pager log --pretty=%H $local_sha1...$remote_sha1)
+ echo "You're about to push $n commits to protected branch $b on $remote."
+ read -p "Do you want to proceed? [y|n] " reply < /dev/tty
+ if echo $reply | grep -E '^[Yy]$' > /dev/null; then
+ exit 1
+ exit 0
More information about the dev