Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions sentinelops-backend/app/routers/local_dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ async def list_repos():
@router.post("/repos/link")
async def link_repo(req: LinkRepoRequest):
"""Link a GitHub repo to a local folder."""
success = local_git.link_repo(req.name, req.local_path, req.github_url)
validated_path = local_git._validate_repo_path_for_linking(req.local_path)
if not validated_path:
raise HTTPException(
status_code=400,
detail=(
"Invalid path — no .git directory found. "
"Make sure the folder is a git repo."
),
)
success = local_git.link_repo(req.name, validated_path, req.github_url)
if not success:
raise HTTPException(
status_code=400,
Expand All @@ -50,7 +59,7 @@ async def link_repo(req: LinkRepoRequest):
"Make sure the folder is a git repo."
),
)
return {"status": "linked", "name": req.name, "local_path": req.local_path}
return {"status": "linked", "name": req.name, "local_path": validated_path}


@router.delete("/repos/unlink")
Expand Down
Loading