Author SHA1 Message Date
Eleboba 4f4754f15e Merge branch 'dev' into feat/26-drafts 2026-10-15 19:31:23 +03:00
4 changed files with 3 additions and 31 deletions
+1 -2
View File
@@ -24,6 +24,5 @@ build/
.claude/worktrees/
.DS_Store
# local run without Docker: SQLite DB, uploads clone, demo repo
# local SQLite DB (bot without Docker)
*.db
data/
+1 -16
View File
@@ -1,4 +1,4 @@
.PHONY: install lint fmt typecheck test cov up down logs ps run demo-repo
.PHONY: install lint fmt typecheck test cov up down logs ps
install:
uv sync
@@ -30,18 +30,3 @@ logs:
ps:
docker compose ps
# Run the bot on this machine without Docker: SQLite (./tgit.db) and the settings from .env
run:
uv run python -m app
# A local uploads repo seeded from the template — try the bot without SourceCraft:
# make demo-repo → put the printed GIT_UPLOADS_URL into .env → make run
DEMO_REPO := $(CURDIR)/data/demo-uploads.git
demo-repo:
@test ! -e $(DEMO_REPO) || { echo "$(DEMO_REPO) already exists"; exit 1; }
@rm -rf data/demo-seed && mkdir -p data && cp -r infra/uploads-template data/demo-seed
@cd data/demo-seed && git init -q -b main && git add -A \
&& git -c user.name=tgit-bot -c user.email=tgit-bot@users.noreply.tgit commit -qm "init: uploads template"
@git clone -q --bare data/demo-seed $(DEMO_REPO) && rm -rf data/demo-seed
@echo "GIT_UPLOADS_URL=$(DEMO_REPO)"
+1 -2
View File
@@ -47,8 +47,7 @@ class CommitInfo:
class UploadsRepo:
def __init__(self, settings: GitSettings) -> None:
self._s = settings
# absolute: git clone runs from the parent dir, a relative path would land one level deeper
self._dir = settings.clone_dir.resolve()
self._dir = settings.clone_dir
self._lock = asyncio.Lock()
self._fetched_at: float | None = None
self._key_path = self._materialize_key()
-11
View File
@@ -83,14 +83,3 @@ async def test_unreachable_remote(tmp_path: Path) -> None:
broken = UploadsRepo(GitSettings(uploads_url=str(tmp_path / "missing.git"), clone_dir=tmp_path / "c3"))
with pytest.raises(GitError, match="clone"):
await broken.refresh()
async def test_relative_clone_dir(remote: Path, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
from app.config import GitSettings
monkeypatch.chdir(tmp_path)
relative = UploadsRepo(GitSettings(uploads_url=str(remote), clone_dir=Path("data/uploads")))
await relative.refresh()
assert (tmp_path / "data" / "uploads" / ".git").is_dir()
assert "README.md" in [e.name for e in await relative.list_dir()]