wrolpi/modules/repos/schema.py
Roland 89dad0570a
repos: import moves the clone where it was inspected; inspect never reads its config
* Inspect takes the URL the import will use, so a destination using
  %(repo_host)s/%(repo_owner)s is computed the same way by both (it used
  the origin's, while import used the submitted URL's).  Import requires
  the inspected destination, and refuses to move the clone anywhere else.
* Inspect runs git against a throwaway git directory holding the clone's
  HEAD, refs and (through alternates) objects, so the clone's unsanitized
  config (and anything it includes) is never read.
* A submodule's `.git` file is read as git reads it: only the line
  ending is trimmed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 19:11:17 -06:00

55 lines
1.3 KiB
Python

from dataclasses import dataclass, field
from typing import Optional, List
@dataclass
class RepoCreateRequest:
url: str
tag_name: Optional[str] = None
frequency: Optional[int] = None
mode: Optional[str] = None
branch: Optional[str] = None
name: Optional[str] = None
description: Optional[str] = None
submodules: bool = False
@dataclass
class RepoSearchRequest:
search_str: Optional[str] = None
tag_names: List[str] = field(default_factory=list)
limit: int = 20
offset: int = 0
@dataclass
class RepoUpdateRequest:
description: Optional[str] = None
frequency: Optional[int] = None
mode: Optional[str] = None
branch: Optional[str] = None
submodules: Optional[bool] = None
@dataclass
class RepoImportInspectRequest:
directory: str
name: Optional[str] = None
tag_name: Optional[str] = None
url: Optional[str] = None
@dataclass
class RepoImportRequest:
directory: str
# The destination the inspection reported; the import is refused if the clone would be moved anywhere else.
destination: str
confirm: bool = False
url: Optional[str] = None
tag_name: Optional[str] = None
frequency: Optional[int] = None
mode: Optional[str] = None
branch: Optional[str] = None
submodules: bool = False
name: Optional[str] = None
description: Optional[str] = None