On (28/09/15 14:19), Jakub Hrozek wrote:
Hi,
to activate this hook, copy it from contrib to .git/hooks and make sure
the executable flag is on. Attempting to push a commit without
Reviewed-By will then trigger an error.
Good idea.
If we want to be truly strict about not pushing commits without a RB
tag, then we need a server-side hook.
As you wish.
From 391666fda49fef9ac003d192e7ae8a3c2b00e113 Mon Sep 17 00:00:00
2001
From: Jakub Hrozek <jhrozek(a)redhat.com>
Date: Mon, 28 Sep 2015 13:46:39 +0200
Subject: [PATCH] contrib: Add a pre-push hook to warn about commits without
Reviewed-By
---
contrib/git/pre-push | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100755 contrib/git/pre-push
diff --git a/contrib/git/pre-push b/contrib/git/pre-push
Initially, I thought it
does not work because I tested with
creating a new branch
git push origin master:new_branch
However it works after trying to push another patch to this branch.
There are few pep8 warning
sh$ pep8 contrib/git/pre-push
contrib/git/pre-push:10:1: E302 expected 2 blank lines, found 1
contrib/git/pre-push:11:13: E201 whitespace after '['
contrib/git/pre-push:11:70: E202 whitespace before ']'
contrib/git/pre-push:14:13: E201 whitespace after '['
contrib/git/pre-push:14:74: E202 whitespace before ']'
contrib/git/pre-push:16:1: E302 expected 2 blank lines, found 1
contrib/git/pre-push:17:13: E201 whitespace after '['
contrib/git/pre-push:17:54: E202 whitespace before ']'
contrib/git/pre-push:22:1: E302 expected 2 blank lines, found 1
contrib/git/pre-push:31:1: E302 expected 2 blank lines, found 1
contrib/git/pre-push:39:1: E302 expected 2 blank lines, found 1
It would be also good to add small howto from mail.
"copy it from contrib to .git/hooks and make sure
the executable flag is on" to the commit message or better to
README into directory contrib/git/
and you can also mention hint about .git-commit-template
commit 3d9edb4c510028def2df41aa7b0ce705b197e6fc
Author: Simo Sorce <simo(a)redhat.com>
Date: Mon Aug 5 13:59:33 2013 -0400
Add a commit template
Explanation:
In order to use a common style when creating commits a commit template will be
helpful espcially to new developers.
The commit template can be activated with the following command:
git config commit.template .git-commit-template
When this is done any new commit will use the template as the default commit
message.
LS