prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Consider using --no-checkout for cloning
  I'd assume it is faster...
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pre_commit/repository.py`
  Content:
  ```
  1 
  2 import contextlib
  3 from plumbum import local
  4 
  5 import pre_commit.constants as C
  6 from pre_commit.clientlib.validate_manifest import validate_manifest
  7 from pre_commit.hooks_workspace import in_hooks_workspace
  8 from pre_commit.languages.all import languages
  9 from pre_commit.util import cached_property
  10 
  11 
  12 class Repository(object):
  13     def __init__(self, repo_config):
  14         self.repo_config = repo_config
  15 
  16     @cached_property
  17     def repo_url(self):
  18         return self.repo_config['repo']
  19 
  20     @cached_property
  21     def sha(self):
  22         return self.repo_config['sha']
  23 
  24     @cached_property
  25     def languages(self):
  26         return set(filter(None, (
  27             hook.get('language') for hook in self.hooks.values()
  28         )))
  29 
  30     @cached_property
  31     def hooks(self):
  32         return dict(
  33             (hook['id'], dict(hook, **self.manifest[hook['id']]))
  34             for hook in self.repo_config['hooks']
  35         )
  36 
  37     @cached_property
  38     def manifest(self):
  39         with self.in_checkout():
  40             return dict(
  41                 (hook['id'], hook)
  42                 for hook in validate_manifest(C.MANIFEST_FILE)
  43             )
  44 
  45     @contextlib.contextmanager
  46     def in_checkout(self):
  47         with in_hooks_workspace():
  48             # SMELL:
  49             self.create()
  50             with local.cwd(self.sha):
  51                 yield
  52 
  53     def create(self):
  54         with in_hooks_workspace():
  55             if local.path(self.sha).exists():
  56                 # Project already exists, no reason to re-create it
  57                 return
  58 
  59             local['git']['clone', self.repo_url, self.sha]()
  60             with self.in_checkout():
  61                 local['git']['checkout', self.sha]()
  62 
  63     def install(self):
  64         with self.in_checkout():
  65             for language in C.SUPPORTED_LANGUAGES:
  66                 if language in self.languages:
  67                     languages[language].install_environment()
  68 
  69     def run_hook(self, hook_id, file_args):
  70         with self.in_checkout():
  71             hook = self.hooks[hook_id]
  72             return languages[hook['language']].run_hook(hook, file_args)
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/pre_commit/repository.py b/pre_commit/repository.py
  --- a/pre_commit/repository.py
  +++ b/pre_commit/repository.py
  @@ -56,7 +56,7 @@
                   # Project already exists, no reason to re-create it
                   return
   
  -            local['git']['clone', self.repo_url, self.sha]()
  +            local['git']['clone', '--no-checkout', self.repo_url, self.sha]()
               with self.in_checkout():
                   local['git']['checkout', self.sha]()
   
  @@ -69,4 +69,4 @@
       def run_hook(self, hook_id, file_args):
           with self.in_checkout():
               hook = self.hooks[hook_id]
  -            return languages[hook['language']].run_hook(hook, file_args)
  \ No newline at end of file
  +            return languages[hook['language']].run_hook(hook, file_args)
  
verification_info: {"golden_diff": "diff --git a/pre_commit/repository.py b/pre_commit/repository.py\n--- a/pre_commit/repository.py\n+++ b/pre_commit/repository.py\n@@ -56,7 +56,7 @@\n                 # Project already exists, no reason to re-create it\n                 return\n \n-            local['git']['clone', self.repo_url, self.sha]()\n+            local['git']['clone', '--no-checkout', self.repo_url, self.sha]()\n             with self.in_checkout():\n                 local['git']['checkout', self.sha]()\n \n@@ -69,4 +69,4 @@\n     def run_hook(self, hook_id, file_args):\n         with self.in_checkout():\n             hook = self.hooks[hook_id]\n-            return languages[hook['language']].run_hook(hook, file_args)\n\\ No newline at end of file\n+            return languages[hook['language']].run_hook(hook, file_args)\n", "issue": "Consider using --no-checkout for cloning\nI'd assume it is faster...\n\n", "before_files": [{"content": "\nimport contextlib\nfrom plumbum import local\n\nimport pre_commit.constants as C\nfrom pre_commit.clientlib.validate_manifest import validate_manifest\nfrom pre_commit.hooks_workspace import in_hooks_workspace\nfrom pre_commit.languages.all import languages\nfrom pre_commit.util import cached_property\n\n\nclass Repository(object):\n    def __init__(self, repo_config):\n        self.repo_config = repo_config\n\n    @cached_property\n    def repo_url(self):\n        return self.repo_config['repo']\n\n    @cached_property\n    def sha(self):\n        return self.repo_config['sha']\n\n    @cached_property\n    def languages(self):\n        return set(filter(None, (\n            hook.get('language') for hook in self.hooks.values()\n        )))\n\n    @cached_property\n    def hooks(self):\n        return dict(\n            (hook['id'], dict(hook, **self.manifest[hook['id']]))\n            for hook in self.repo_config['hooks']\n        )\n\n    @cached_property\n    def manifest(self):\n        with self.in_checkout():\n            return dict(\n                (hook['id'], hook)\n                for hook in validate_manifest(C.MANIFEST_FILE)\n            )\n\n    @contextlib.contextmanager\n    def in_checkout(self):\n        with in_hooks_workspace():\n            # SMELL:\n            self.create()\n            with local.cwd(self.sha):\n                yield\n\n    def create(self):\n        with in_hooks_workspace():\n            if local.path(self.sha).exists():\n                # Project already exists, no reason to re-create it\n                return\n\n            local['git']['clone', self.repo_url, self.sha]()\n            with self.in_checkout():\n                local['git']['checkout', self.sha]()\n\n    def install(self):\n        with self.in_checkout():\n            for language in C.SUPPORTED_LANGUAGES:\n                if language in self.languages:\n                    languages[language].install_environment()\n\n    def run_hook(self, hook_id, file_args):\n        with self.in_checkout():\n            hook = self.hooks[hook_id]\n            return languages[hook['language']].run_hook(hook, file_args)", "path": "pre_commit/repository.py"}], "after_files": [{"content": "\nimport contextlib\nfrom plumbum import local\n\nimport pre_commit.constants as C\nfrom pre_commit.clientlib.validate_manifest import validate_manifest\nfrom pre_commit.hooks_workspace import in_hooks_workspace\nfrom pre_commit.languages.all import languages\nfrom pre_commit.util import cached_property\n\n\nclass Repository(object):\n    def __init__(self, repo_config):\n        self.repo_config = repo_config\n\n    @cached_property\n    def repo_url(self):\n        return self.repo_config['repo']\n\n    @cached_property\n    def sha(self):\n        return self.repo_config['sha']\n\n    @cached_property\n    def languages(self):\n        return set(filter(None, (\n            hook.get('language') for hook in self.hooks.values()\n        )))\n\n    @cached_property\n    def hooks(self):\n        return dict(\n            (hook['id'], dict(hook, **self.manifest[hook['id']]))\n            for hook in self.repo_config['hooks']\n        )\n\n    @cached_property\n    def manifest(self):\n        with self.in_checkout():\n            return dict(\n                (hook['id'], hook)\n                for hook in validate_manifest(C.MANIFEST_FILE)\n            )\n\n    @contextlib.contextmanager\n    def in_checkout(self):\n        with in_hooks_workspace():\n            # SMELL:\n            self.create()\n            with local.cwd(self.sha):\n                yield\n\n    def create(self):\n        with in_hooks_workspace():\n            if local.path(self.sha).exists():\n                # Project already exists, no reason to re-create it\n                return\n\n            local['git']['clone', '--no-checkout', self.repo_url, self.sha]()\n            with self.in_checkout():\n                local['git']['checkout', self.sha]()\n\n    def install(self):\n        with self.in_checkout():\n            for language in C.SUPPORTED_LANGUAGES:\n                if language in self.languages:\n                    languages[language].install_environment()\n\n    def run_hook(self, hook_id, file_args):\n        with self.in_checkout():\n            hook = self.hooks[hook_id]\n            return languages[hook['language']].run_hook(hook, file_args)\n", "path": "pre_commit/repository.py"}]}