[sysadmin-bin] run-git-or-special-cmnd: Fix checking for hooks
- From: Owen Taylor <otaylor src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] run-git-or-special-cmnd: Fix checking for hooks
- Date: Fri, 6 Sep 2013 16:58:55 +0000 (UTC)
commit 625e1de7bf2fafafe546066336825e2b51ac5835
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Fri Sep 6 12:58:46 2013 -0400
run-git-or-special-cmnd: Fix checking for hooks
run-git-or-special-cmd | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/run-git-or-special-cmd b/run-git-or-special-cmd
index 3db2d05..d3303af 100755
--- a/run-git-or-special-cmd
+++ b/run-git-or-special-cmd
@@ -41,6 +41,14 @@ def find_and_normalize_git_dir(path):
finally:
os.chdir(curpath)
+def check_hook(path, which):
+ try:
+ dest = os.readlink(path + '/hooks/' + which)
+ except OSError:
+ return False
+ return dest == '/home/admin/bin/git/gnome-' + which or dest == '/home/admin/gitadmin-bin/gno\
+me-' + which
+
def validate_git_dir(path):
path = find_and_normalize_git_dir(path)
if path is None:
@@ -52,8 +60,7 @@ def validate_git_dir(path):
sys.exit(1)
if (not is_sysadmin and
- (os.readlink(path + '/hooks/pre-receive') != '/home/admin/bin/git/gnome-pre-receive' or
- os.readlink(path + '/hooks/post-receive') != '/home/admin/bin/git/gnome-post-receive')):
+ (!check_hook(path, 'pre-receive' or !check_hook(path, 'post-receive')))):
print >>sys.stderr, "git repository doesn't have required gnome.org hooks."
sys.exit(1)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]