gclient: Handle missing .git/hooks directory

Change-Id: I5d1c43546bb4ac57b9bb57f47e9ef04f1b19bc0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4881087
Auto-Submit: Philipp Wollermann <philwo@google.com>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Philipp Wollermann <philwo@google.com>
changes/87/4881087/2
Philipp Wollermann 2 years ago committed by LUCI CQ
parent 8572d4bdcd
commit a45d2d4c90

@ -2006,6 +2006,9 @@ it or fix the checkout.
if not os.path.exists(git_dir):
return
git_hooks_dir = os.path.join(git_dir, 'hooks')
os.makedirs(git_hooks_dir, exist_ok=True)
hook = os.path.join(git_dir, 'hooks', 'pre-commit')
if os.path.exists(hook):
with open(hook, 'r') as f:

Loading…
Cancel
Save