summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2008-10-29 14:38:12 -0700
committerShawn O. Pearce <sop@google.com>2008-10-29 14:38:12 -0700
commitde646819b8e43a906d86a579c68118cad31934cc (patch)
tree2133f50781f6849d3f8de8ae3a95b5a6c1853063
parentbd4edc9a6996d666edfa77b6b80615ee7c8ea335 (diff)
downloadgit-repo-de646819b8e43a906d86a579c68118cad31934cc.tar.gz
Don't flip out if there are no template hooks
Git may have been installed without its hooks directory, which means we won't have any hooks in a repo created git repository. Since we are just deleting the hooks it doesn't matter. Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--project.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/project.py b/project.py
index 46d23f62..120264f7 100644
--- a/project.py
+++ b/project.py
@@ -775,7 +775,11 @@ class Project(object):
775 self.config.SetString('core.bare', None) 775 self.config.SetString('core.bare', None)
776 776
777 hooks = self._gitdir_path('hooks') 777 hooks = self._gitdir_path('hooks')
778 for old_hook in os.listdir(hooks): 778 try:
779 to_rm = os.listdir(hooks)
780 except OSError:
781 to_rm = []
782 for old_hook in to_rm:
779 os.remove(os.path.join(hooks, old_hook)) 783 os.remove(os.path.join(hooks, old_hook))
780 784
781 # TODO(sop) install custom repo hooks 785 # TODO(sop) install custom repo hooks