File tree Expand file tree Collapse file tree 1 file changed +9
-15
lines changed
vulnerabilities/pipelines/v2_importers Expand file tree Collapse file tree 1 file changed +9
-15
lines changed Original file line number Diff line number Diff line change 1- import os
21import re
32import shutil
4- import subprocess
53import tempfile
64from collections import defaultdict
75
@@ -38,17 +36,13 @@ def clone(self):
3836 """Clone the repository."""
3937 self .repo_url = "https://github.com/torvalds/linux"
4038 repo_path = tempfile .mkdtemp ()
41- cmd = [
42- "git" ,
43- "clone" ,
44- "--bare" ,
45- "--filter=blob:none" ,
46- "--no-checkout" ,
47- self .repo_url ,
48- repo_path ,
49- ]
50- subprocess .run (cmd , check = True )
51- self .repo = Repo (repo_path )
39+ self .repo = Repo .clone_from (
40+ url = self .repo_url ,
41+ to_path = repo_path ,
42+ bare = True ,
43+ no_checkout = True ,
44+ multi_options = ["--filter=blob:none" ],
45+ )
5246
5347 def advisories_count (self ) -> int :
5448 return int (self .repo .git .rev_list ("--count" , "HEAD" ))
@@ -109,8 +103,8 @@ def collect_advisories(self):
109103 def clean_downloads (self ):
110104 """Cleanup any temporary repository data."""
111105 self .log ("Cleaning up local repository resources." )
112- if os . path . isdir (self .repo .working_tree_dir ) :
113- shutil .rmtree (path = self .repo .working_tree_dir )
106+ if hasattr (self , "repo" ) and self .repo .working_dir :
107+ shutil .rmtree (path = self .repo .working_dir )
114108
115109 def on_failure (self ):
116110 """Ensure cleanup is always performed on failure."""
You can’t perform that action at this time.
0 commit comments