From cab27352d2768ac8238c57dfc892f81f3a2a3f63 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Tue, 17 Apr 2018 15:26:02 +0200 Subject: [PATCH] Some more fixes to the script Signed-off-by: Pierre-Yves Chibon --- roles/git/checks/files/distgit_check_hook.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/roles/git/checks/files/distgit_check_hook.py b/roles/git/checks/files/distgit_check_hook.py index 863231c762..9d21482755 100644 --- a/roles/git/checks/files/distgit_check_hook.py +++ b/roles/git/checks/files/distgit_check_hook.py @@ -57,7 +57,7 @@ def is_valid_hook(hook, target_link): return output -def process_namespace(namespace): +def process_namespace(namespace, check): """ Process all the git repo in a specified namespace. """ target_link = _target_link if namespace == 'forks': @@ -66,7 +66,7 @@ def process_namespace(namespace): print('Processing: %s' % namespace) path = os.path.join(_base_path, namespace) if not os.path.isdir(path): - continue + return for dirpath, dirnames, filenames in os.walk(path): # Don't go down the .git repos @@ -79,7 +79,7 @@ def process_namespace(namespace): continue hook = os.path.join(repo_path, 'hooks', 'post-receive') - if not is_valid_hook(hook, target_link) and not args.check: + if not is_valid_hook(hook, target_link) and not check: fix_link(hook, target_link) @@ -111,13 +111,12 @@ def main(): fix_link(hook, target_link) elif args.namespace: - process_namespace(args.namespace) + process_namespace(args.namespace, args.check) else: # Check all repos for namespace in namespaces: - process_namespace(namespace) + process_namespace(namespace, args.check) if __name__ == '__main__': sys.exit(main()) -