File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 1
1
import asyncio
2
+ from typing import Tuple
2
3
3
4
from .decorators import async_timeout
4
5
from config import CLONE_TIMEOUT
5
6
7
+ async def check_repo_exists (url : str ) -> Tuple [bool , str ]:
8
+ """
9
+ Check if a repository exists and is accessible.
10
+ Returns a tuple of (exists: bool, error_message: str)
11
+ """
12
+ proc = await asyncio .create_subprocess_exec (
13
+ "git" ,
14
+ "ls-remote" ,
15
+ url ,
16
+ stdout = asyncio .subprocess .PIPE ,
17
+ stderr = asyncio .subprocess .PIPE ,
18
+ )
19
+ _ , stderr = await proc .communicate ()
20
+ if proc .returncode != 0 :
21
+ return False
22
+ return True
6
23
7
24
@async_timeout (CLONE_TIMEOUT )
8
25
async def clone_repo (query : dict ) -> str :
9
-
26
+ if not await check_repo_exists (query ['url' ]):
27
+ raise ValueError ("Repository not found, make sure it is public" )
28
+
10
29
if query ['commit' ]:
11
30
proc = await asyncio .create_subprocess_exec (
12
31
"git" ,
You can’t perform that action at this time.
0 commit comments