changeset 3:3a06b35bd591 default tip

Avoid infinite recursion on hook call ("clone bomb")
author Louis Opter <louis.opter@dotcloud.com>
date Thu, 25 Mar 2010 20:09:55 +0100
parents a85cbad8dadb
children
files doxyhook.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/doxyhook.py	Thu Mar 25 18:51:20 2010 +0100
+++ b/doxyhook.py	Thu Mar 25 20:09:55 2010 +0100
@@ -50,11 +50,15 @@
     def __exit__(self, exc_type, exc_value, traceback):
         shutil.rmtree(self.__path)
 
-def clone_repo(ui, source, dest):
+def clone_repo(sui, source, dest):
     """Clone repo at directory source to directory dest"""
 
-    commands.clone(ui, source, dest, opts={'uncompressed': True})
-    ui.status('doxyhook: working copy created.\n')
+    # We have to use a different ui than the source ui. If you don't take this
+    # precaution your hook will be called recursively by the clone command,
+    # leading to a clone bomb.
+    cui = ui.ui()
+    commands.clone(cui, source, dest, opts={'uncompressed': True})
+    sui.status('doxyhook: working copy created.\n')
 
 def gen_doc(clone):
     """