mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Clean up directories on failure. Closes #58.
This commit is contained in:
parent
443b62d56a
commit
bcb00726a1
8 changed files with 103 additions and 38 deletions
|
|
@ -9,6 +9,7 @@ from pre_commit.languages.all import languages
|
|||
from pre_commit.ordereddict import OrderedDict
|
||||
from pre_commit.prefixed_command_runner import PrefixedCommandRunner
|
||||
from pre_commit.util import cached_property
|
||||
from pre_commit.util import clean_path_on_failure
|
||||
|
||||
|
||||
class Repository(object):
|
||||
|
|
@ -62,9 +63,10 @@ class Repository(object):
|
|||
# Project already exists, no reason to re-create it
|
||||
return
|
||||
|
||||
local['git']['clone', '--no-checkout', self.repo_url, self.sha]()
|
||||
with self.in_checkout():
|
||||
local['git']['checkout', self.sha]()
|
||||
with clean_path_on_failure(unicode(local.path(self.sha))):
|
||||
local['git']['clone', '--no-checkout', self.repo_url, self.sha]()
|
||||
with self.in_checkout():
|
||||
local['git']['checkout', self.sha]()
|
||||
|
||||
def require_installed(self, cmd_runner):
|
||||
if self.__installed:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue