project: prune sample hooks

These hooks are never used and often get stale, so just trim them.
Users rarely look in these dirs to begin with.

Change-Id: Ic785aa55fb7ec84a61376df101127d0018882030
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/327538
Reviewed-by: Jack Neus <jackneus@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger 2021-12-20 21:15:59 -05:00
parent d33dce0b77
commit 98bb76577d

View File

@ -2548,6 +2548,11 @@ class Project(object):
hooks = platform_utils.realpath(os.path.join(self.objdir, 'hooks'))
if not os.path.exists(hooks):
os.makedirs(hooks)
# Delete sample hooks. They're noise.
for hook in glob.glob(os.path.join(hooks, '*.sample')):
platform_utils.remove(hook, missing_ok=True)
for stock_hook in _ProjectHooks():
name = os.path.basename(stock_hook)