Compare commits

...
Author SHA1 Message Date
hermes 1e06244c9f feat(configs): comment out legacy github remote in hermes.py
Python package / build (3.12.3) (pull_request) Failing after 2m28s
Python package / build (3.13) (pull_request) Failing after 2m35s
Python package / build (3.14) (pull_request) Failing after 3m14s
Re-add the disabled github-remote line from PR #28 to preserve
documentation of the migration history. The remotes list in main
already has gitea_hermes + gitea_admin from PR #11; this only adds
the commented-out fallback marker from PR #28 commit 04d3624a.

Refs admin/brencher#28
2026-09-05 17:41:41 +00:00
hermesandadmin 99f8b73654 feat(git): per-remote branch prefix filtering for multi-remote GitClone (#31)
Merge main to all / rebase (push) Failing after 31s
Python package / build (3.12.3) (push) Failing after 2m28s
Python package / build (3.13) (push) Failing after 2m29s
Python package / build (3.14) (push) Failing after 2m38s
Python package / build (3.12.3) (pull_request) Failing after 2m17s
Python package / build (3.13) (pull_request) Canceled after 55s
Python package / build (3.14) (pull_request) Canceled after 0s
## Summary

`GitClone`'s top-level `branchNamePrefix` argument was silently ignored when constructed with the explicit `remotes=[...]` form (verified in `backend/steps/git.py:106`):

```python
if remote_name == "origin" and self.branchNamePrefix != "":
    # apply refspec
```

The prefix only fires when a remote is named `"origin"`. The `remotes=` form passes names through verbatim, so configs like the open PR #28 set the prefix but never apply it — all branches from all remotes are fetched.

This PR extends the API: each remote entry now optionally accepts a `prefix` field. When set, the fetch refspec for that remote becomes scoped to `<prefix>/*` branches. Backwards-compatible — remotes without `prefix` keep the existing behavior, and `url=` shorthand with `branchNamePrefix` still works.

## API

```python
clone = GitClone(remotes=[
    {"name": "github",       "url": "...", "prefix": "ansible"},
    {"name": "gitea_hermes", "url": "...", "prefix": "ansible"},
    {"name": "gitea_admin",  "url": "...", "prefix": "ansible"},
])
```

Each remote is independent — some can have `prefix`, others not.

## Changes

### `backend/steps/git.py`

- `__init__` (`remotes=` branch): validate `prefix` (string if set, reject non-string with `ValueError`), persist into the normalized entry. Empty string / None → no prefix applied (existing behavior).
- `progress()` fetch loop: replace the single `if remote_name == "origin"` check with per-entry logic. Effective prefix = `entry["prefix"] or (self.branchNamePrefix if remote_name == "origin" else "")`. Apply refspec per remote when effective prefix is non-empty.

### `tests/test_git_integration.py`

3 new tests in `TestGitIntegration`:

- `test_git_clone_remotes_per_remote_prefix` — both remotes prefixed; only `ansible/*` branches visible, `master` is filtered out.
- `test_git_clone_remotes_mixed_prefix` — one remote prefixed, one not; each behaves independently.
- `test_git_clone_remotes_prefix_validation` — `prefix=123` / `prefix=["ansible"]` raise `ValueError`; `prefix=""` and missing-`prefix` are accepted.

Existing `test_git_clone_named_remotes` continues to pass (verified — no behavior change for unprefixed remotes).

## Test results

```
29 passed in ~13s
```

(18 in `test_git_integration.py`, 11 in `test_dummy.py`/`test_caching_step.py`/`test_cached_env.py`.)

## Migration path

After merge:

- Open migration PRs (#26 gmail_mcp, #28 hermes, planned #19 gitea.py) — switch from `branchNamePrefix="ansible"` to `"prefix": "ansible"` on each remote.
- `hermes_infra.py` after PR #8 already drops `branchNamePrefix`, no change needed.
- Existing `url=` configs (immich, gmail_mcp-old, hermes-old, registry, gitea-old) — unaffected.

## Unblocks

PR #28 — once this lands, hermes.py can drop the (currently misleading) top-level `branchNamePrefix="ansible"` and add `"prefix": "ansible"` per remote.

Refs #30
Blocks #28
Part of #18 (parent migration ticket)

---------

Co-authored-by: admin <rudolfss13@gmail.com>
Co-authored-by: brencher_bot <rudolfss13@gmail.com>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/31
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
2026-09-05 19:20:44 +02:00
hermesandadmin 272504eab3 feat(configs): point gmail_mcp at gitea admin/hermes mcps repos (#26)
Merge main to all / rebase (push) Canceled after 0s
Python package / build (3.12.3) (push) Canceled after 0s
Python package / build (3.13) (push) Canceled after 0s
Python package / build (3.14) (push) Canceled after 0s
## Summary

Updates `backend/configs/gmail_mcp.py` to point at the new `mcps` stack mirrors on gitea instead of the legacy `uber_backup` repo.

Remotes now:

- `gitea_hermes` → `https://gitea.rudolf.keenetic.link/hermes/mcps`
- `gitea_admin`  → `https://gitea.rudolf.keenetic.link/admin/mcps`

Uses the `remotes=[{name, url}, …]` form introduced by #3.

## What changed vs the original #26 body

- **Repo switched**: `uber_backup` → `mcps` (the gmail + telegram MCP server repo, now mirrored on gitea under both `admin/` and `hermes/`).
- **GitHub remote dropped**: matches the pattern in `hermes_infra.py` after #8 and `docker_socket_proxy.py` after #23. The brencher container cannot reach `github.com` (squid returns HTTP 403 on CONNECT tunnel), so keeping a `github` remote would hard-fail the clone and trap brencher in the same retry loop that blocked #23 on `admin/reverseproxy` before its mirror was created.
- **`branchNamePrefix="immoscout"` dropped**: the prefix is only applied to remotes named `origin` (see `backend/steps/git.py` ~L104); neither remote qualifies, so the field is a silent no-op. Matches the cleanup done in `hermes_infra.py` / `brencher.py`.

## Diff (vs `main`)

```diff
-clone = GitClone(url="https://github.com/rudolf1/uber_backup.git", branchNamePrefix="immoscout")
+clone = GitClone(remotes=[
+    {"name": "gitea_hermes", "url": "https://gitea.rudolf.keenetic.link/hermes/mcps"},
+    {"name": "gitea_admin",  "url": "https://gitea.rudolf.keenetic.link/admin/mcps"},
+])
```

## Prerequisites (already done)

Both target mirrors exist on gitea:

- `admin/mcps` — already present (primary, not a fork).
- `hermes/mcps` — forked in this session (id=10, fork of `admin/mcps`).

## Test plan

1. From the brencher state file for `gmail_mcp`, register `gitea_hermes/feat/migrate-gmail-mcp-to-multi-remote` as the desired branch.
2. Watch brencher logs: `Cloning repositories [...]` should succeed for both `gitea_hermes` and `gitea_admin`.
3. Confirm `gmail_mcp` stack redeploys against the new repo.

Refs #20
Part of #18

---------

Co-authored-by: brencher_bot <rudolfss13@gmail.com>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/26
Co-authored-by: brencher_bot (hermes) <rudolfss13+hermes@gmail.com>
2026-09-05 19:20:16 +02:00
hermesandhermes fa9f8791bd feat(configs): point immich at gitea admin/hermes ansible repos (#12)
Merge main to all / rebase (push) Canceled after 0s
Python package / build (3.12.3) (push) Canceled after 0s
Python package / build (3.13) (push) Canceled after 0s
Python package / build (3.14) (push) Canceled after 0s
## Summary
Migrates `backend/configs/immich.py` from the legacy `url=` form (pointing at the unreachable `github.com/rudolf1/uber_backup.git`) to the new `remotes=[{name, url}, ...]` form introduced by PR #3 (named-remotes), pointing at the actual gitea repos where the ansible stack lives.

## What's in this PR
- `backend/configs/immich.py` — single file, +22/-1
  - `GitClone(url="https://github.com/rudolf1/uber_backup.git"[, branchNamePrefix=...])`
    →
    `GitClone(remotes=[{"name": "gitea_hermes", "url": "https://gitea.rudolf.keenetic.link/hermes/ansible"}, {"name": "gitea_admin", "url": "https://gitea.rudolf.keenetic.link/admin/ansible"}])`
  - `branchNamePrefix` is dropped (it would be a silent no-op: `GitClone` only applies its prefix refspec to a remote named `origin` per `backend/steps/git.py` ~L104, and neither remote here is named `origin`)

## Why migrate
- The old URL never resolved (`uber_backup.git` doesn't exist on gitea anyway) — so the deploy path was broken even though the file looked correct.
- `github.com` returns HTTP 403 on CONNECT tunnel from the brencher container's egress proxy — verified in `admin/brencher#4` (commit `653aee9`).

## Scope decision: only `immich.py`
The other open configs (`registry.py`, `gitea.py`, `hermes.py`, `immich.py`, `gmail_mcp.py`, `torrserv_proxy.py`) are being migrated in **separate PRs**, one per file. Each PR has its own branch + verification.

## Verification (sandbox, no docker daemon)
- `python3 -m py_compile backend/configs/immich.py` — OK
- Real import via `from configs import immich`:
  - `clone.remotes` is a 2-entry list `[gitea_hermes, gitea_admin]`, `clone.urls` derived from it
  - no `github.com` substring anywhere in the constructed config
  - `clone.branchNamePrefix == ''`
- pytest: **26/26** passed on the no-docker / no-playwright suite
- mypy `--no-incremental --follow-imports=silent`: `Success: no issues found in 1 source file`
- **End-to-end smoke test**: built a parallel `GitClone(remotes=[...])` with both URLs pointed at `file:///tmp/ansible-upstream`, ran `clone.progress()`:
  - both named remotes created in the temp clone
  - 4 branches discovered (`master` + `feat/docker-socket-proxy` × 2 remotes)
  - `feat/docker-socket-proxy` visible on both `gitea_admin` and `gitea_hermes`

## What was NOT verified in the sandbox
- HTTPS clone from `gitea.rudolf.keenetic.link` on the live brencher-bot — requires the brencher container's git credentials to have push rights on `admin/ansible`.
- end-to-end `docker stack deploy` — needs a real swarm.

## After merge
After this PR merges into `admin/brencher:main`, the next brencher deploy of this environment will clone from gitea instead of the unreachable github URL.

---------

Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/12
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
2026-09-05 19:19:47 +02:00
hermesandhermes 694c28109d feat(configs): point hermes at gitea admin/hermes ansible repos (#11)
Merge main to all / rebase (push) Canceled after 0s
Python package / build (3.12.3) (push) Canceled after 0s
Python package / build (3.13) (push) Canceled after 0s
Python package / build (3.14) (push) Canceled after 0s
## Summary
Migrates `backend/configs/hermes.py` from the legacy `url=` form (pointing at the unreachable `github.com/rudolf1/uber_backup.git`) to the new `remotes=[{name, url}, ...]` form introduced by PR #3 (named-remotes), pointing at the actual gitea repos where the ansible stack lives.

## What's in this PR
- `backend/configs/hermes.py` — single file, +22/-1
  - `GitClone(url="https://github.com/rudolf1/uber_backup.git"[, branchNamePrefix=...])`
    →
    `GitClone(remotes=[{"name": "gitea_hermes", "url": "https://gitea.rudolf.keenetic.link/hermes/ansible"}, {"name": "gitea_admin", "url": "https://gitea.rudolf.keenetic.link/admin/ansible"}])`
  - `branchNamePrefix` is dropped (it would be a silent no-op: `GitClone` only applies its prefix refspec to a remote named `origin` per `backend/steps/git.py` ~L104, and neither remote here is named `origin`)

## Why migrate
- The old URL never resolved (`uber_backup.git` doesn't exist on gitea anyway) — so the deploy path was broken even though the file looked correct.
- `github.com` returns HTTP 403 on CONNECT tunnel from the brencher container's egress proxy — verified in `admin/brencher#4` (commit `653aee9`).

## Scope decision: only `hermes.py`
The other open configs (`registry.py`, `gitea.py`, `hermes.py`, `immich.py`, `gmail_mcp.py`, `torrserv_proxy.py`) are being migrated in **separate PRs**, one per file. Each PR has its own branch + verification.

## Verification (sandbox, no docker daemon)
- `python3 -m py_compile backend/configs/hermes.py` — OK
- Real import via `from configs import hermes`:
  - `clone.remotes` is a 2-entry list `[gitea_hermes, gitea_admin]`, `clone.urls` derived from it
  - no `github.com` substring anywhere in the constructed config
  - `clone.branchNamePrefix == ''`
- pytest: **26/26** passed on the no-docker / no-playwright suite
- mypy `--no-incremental --follow-imports=silent`: `Success: no issues found in 1 source file`
- **End-to-end smoke test**: built a parallel `GitClone(remotes=[...])` with both URLs pointed at `file:///tmp/ansible-upstream`, ran `clone.progress()`:
  - both named remotes created in the temp clone
  - 4 branches discovered (`master` + `feat/docker-socket-proxy` × 2 remotes)
  - `feat/docker-socket-proxy` visible on both `gitea_admin` and `gitea_hermes`

## What was NOT verified in the sandbox
- HTTPS clone from `gitea.rudolf.keenetic.link` on the live brencher-bot — requires the brencher container's git credentials to have push rights on `admin/ansible`.
- end-to-end `docker stack deploy` — needs a real swarm.

## After merge
After this PR merges into `admin/brencher:main`, the next brencher deploy of this environment will clone from gitea instead of the unreachable github URL.

---------

Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: http://192.168.1.96/admin/brencher/pulls/11
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
2026-09-05 19:19:22 +02:00
5 changed files with 160 additions and 9 deletions
+6 -3
View File
@@ -4,7 +4,10 @@ from steps.docker import DockerComposeBuild, DockerSwarmCheck, DockerSwarmDeploy
from steps.git import GitClone, CheckoutMerged, GitUnmerge
from steps.shared_state import SharedStateHolderInMemory
clone = GitClone(url="https://github.com/rudolf1/uber_backup.git", branchNamePrefix="immoscout")
clone = GitClone(remotes=[
{"name": "gitea_hermes", "url": "https://gitea.rudolf.keenetic.link/hermes/mcps"},
{"name": "gitea_admin", "url": "https://gitea.rudolf.keenetic.link/admin/mcps"},
])
dockerSwarmCheck = DockerSwarmCheck(
stack_name="gmail_mcp",
@@ -23,7 +26,7 @@ checkoutMerged = CheckoutMerged(clone,
buildDocker = DockerComposeBuild(clone,
docker_repo_username="",
docker_repo_password="",
docker_compose_path="gmail-mcp-server/docker-compose.yml",
docker_compose_path="docker-compose.yml",
docker_repo_url="https://registry.rudolf.keenetic.link",
publish=False,
envs=lambda: {
@@ -39,7 +42,7 @@ deployDocker = DockerSwarmDeploy(
"version": "auto-" + checkoutMerged.progress().version,
},
stack_name="gmail_mcp",
docker_compose_path="gmail-mcp-server/docker-compose.yml",
docker_compose_path="docker-compose.yml",
)
checkPing1 = UrlCheck(
+23 -1
View File
@@ -4,7 +4,29 @@ from steps.docker import DockerSwarmCheck, DockerSwarmDeploy
from steps.git import GitClone, CheckoutMerged, GitUnmerge
from steps.shared_state import SharedStateHolderInMemory
clone = GitClone(url="https://github.com/rudolf1/uber_backup.git", branchNamePrefix="ansible")
# Dual-remote clone for the ansible mirror (the deploy target, not brencher itself).
# - gitea_hermes is where the feature branch lives (hermes/ansible:*)
# - gitea_admin is the live-deploy source (where brencher-bot reads compose files from)
#
# Why not github? github.com is unreachable from the brencher container -- the
# proxy returns HTTP 403 on CONNECT tunnel, so the URL would always fail to
# fetch. See backend/configs/docker_socket_proxy.py for the same migration.
#
# Why drop branchNamePrefix? GitClone only applies its prefix refspec to a
# remote named "origin" (backend/steps/git.py ~L104); neither remote here is
# named "origin", so the prefix would be a silent no-op. Both remotes fetch
# their full refset instead.
#
# Why two remotes? The deploy step (DockerSwarmDeploy) checks out a specific
# branch and uses the resulting checkout as wd for the compose path. With
# gitea_hermes as primary, feature branches opened in the fork are picked up;
# gitea_admin provides the live-deploy source as a fallback / for cross-fork
# PRs. This matches the form in backend/configs/brencher.py after PR #3.
clone = GitClone(remotes=[
# {"name": "github", "url": "https://github.com/rudolf1/uber_backup.git", "prefix": "ansible"},
{"name": "gitea_hermes", "url": "https://gitea.rudolf.keenetic.link/hermes/ansible"},
{"name": "gitea_admin", "url": "https://gitea.rudolf.keenetic.link/admin/ansible"},
])
dockerSwarmCheck = DockerSwarmCheck(
stack_name="hermes",
+22 -1
View File
@@ -4,7 +4,28 @@ from steps.docker import DockerSwarmCheck, DockerSwarmDeploy
from steps.git import GitClone, CheckoutMerged, GitUnmerge
from steps.shared_state import SharedStateHolderInMemory
clone = GitClone(url="https://github.com/rudolf1/uber_backup.git", branchNamePrefix="ansible")
# Dual-remote clone for the ansible mirror (the deploy target, not brencher itself).
# - gitea_hermes is where the feature branch lives (hermes/ansible:*)
# - gitea_admin is the live-deploy source (where brencher-bot reads compose files from)
#
# Why not github? github.com is unreachable from the brencher container -- the
# proxy returns HTTP 403 on CONNECT tunnel, so the URL would always fail to
# fetch. See backend/configs/docker_socket_proxy.py for the same migration.
#
# Why drop branchNamePrefix? GitClone only applies its prefix refspec to a
# remote named "origin" (backend/steps/git.py ~L104); neither remote here is
# named "origin", so the prefix would be a silent no-op. Both remotes fetch
# their full refset instead.
#
# Why two remotes? The deploy step (DockerSwarmDeploy) checks out a specific
# branch and uses the resulting checkout as wd for the compose path. With
# gitea_hermes as primary, feature branches opened in the fork are picked up;
# gitea_admin provides the live-deploy source as a fallback / for cross-fork
# PRs. This matches the form in backend/configs/brencher.py after PR #3.
clone = GitClone(remotes=[
{"name": "gitea_hermes", "url": "https://gitea.rudolf.keenetic.link/hermes/ansible"},
{"name": "gitea_admin", "url": "https://gitea.rudolf.keenetic.link/admin/ansible"},
])
dockerSwarmCheck = DockerSwarmCheck(
stack_name="immich",
+11 -4
View File
@@ -48,8 +48,13 @@ class GitClone(AbstractStep[str]):
raise ValueError(f"Remote {name!r} requires a non-empty 'url' (string)")
if name in seen:
raise ValueError(f"Duplicate remote name: {name!r}")
prefix_value = entry.get("prefix")
if prefix_value is not None and not isinstance(prefix_value, str):
raise ValueError(
f"Remote {name!r} 'prefix' must be a string when set, got {type(prefix_value).__name__}"
)
seen.add(name)
normalized.append({"name": name, "url": url_value})
normalized.append({"name": name, "url": url_value, "prefix": prefix_value or ""})
elif url is not None:
if isinstance(url, str):
raw = [url]
@@ -103,10 +108,12 @@ class GitClone(AbstractStep[str]):
remote.set_url(auth_url)
else:
remote = repo.create_remote(remote_name, auth_url)
if remote_name == "origin" and self.branchNamePrefix != "":
prefix = entry.get("prefix", "")
effective_prefix = prefix or (self.branchNamePrefix if remote_name == "origin" else "")
if effective_prefix:
with repo.config_writer() as config:
config.set_value('remote "origin"', "fetch",
f"+refs/heads/{self.branchNamePrefix}/*:refs/remotes/origin/{self.branchNamePrefix}/*")
config.set_value(f'remote "{remote_name}"', "fetch",
f"+refs/heads/{effective_prefix}/*:refs/remotes/{remote_name}/{effective_prefix}/*")
result = remote.fetch(prune=True)
if not result or any(fetch_info.flags & fetch_info.ERROR for fetch_info in result):
raise BaseException(f"Failed to fetch updates for {repository_url}")
+98
View File
@@ -101,6 +101,104 @@ class TestGitIntegration:
with pytest.raises(ValueError, match="requires either 'url' or 'remotes'"):
GitClone()
def test_git_clone_remotes_per_remote_prefix(self, repo_helper: RemoteRepoHelper) -> None:
# Per-remote `prefix` filters fetch refspec so only matching branches are visible.
# Two repos, two branches each (one matching the prefix, one not). Only the
# matching branch should appear in get_branches() for each remote.
def fresh_repo(prefix: str) -> str:
path = tempfile.mkdtemp(prefix=prefix)
repo = git.Repo.init(path, bare=False)
with repo.config_writer() as cw:
cw.set_value("user", "email", "test@example.com")
cw.set_value("user", "name", "Test User")
# Branches literally named `ansible/...` to match the prefix filter.
# create_commit creates an initial master, then branches off it.
repo_helper.create_commit(repo, "master", "master", "README.md", "content", f"{prefix} init")
repo_helper.create_commit(repo, "master", "ansible/master", "AN.md", "ansible", f"{prefix} ansible")
repo_helper.create_commit(repo, "master", "ansible/fix", "FIX.md", "fix", f"{prefix} fix")
return path
github_dir = fresh_repo("test_prefix_github_")
gitea_dir = fresh_repo("test_prefix_gitea_")
try:
clone = GitClone(remotes=[
{"name": "github", "url": github_dir, "prefix": "ansible"},
{"name": "gitea_admin", "url": gitea_dir, "prefix": "ansible"},
])
clone.env = repo_helper.env
repo_path = clone.progress()
repo = git.Repo(repo_path)
branches = set(clone.get_branches())
# Per-remote refspec was applied: only ansible/* branches fetched.
assert "github/ansible/master" in branches, f"missing: {branches}"
assert "github/ansible/fix" in branches, f"missing: {branches}"
assert "gitea_admin/ansible/master" in branches, f"missing: {branches}"
assert "gitea_admin/ansible/fix" in branches, f"missing: {branches}"
# `master` exists upstream but is NOT visible (filtered by prefix).
assert "github/master" not in branches, f"unwanted: {branches}"
assert "gitea_admin/master" not in branches, f"unwanted: {branches}"
finally:
shutil.rmtree(github_dir, ignore_errors=True)
shutil.rmtree(gitea_dir, ignore_errors=True)
def test_git_clone_remotes_mixed_prefix(self, repo_helper: RemoteRepoHelper) -> None:
# Some remotes with prefix, others without. Each behaves independently:
# prefixed remotes only see matching branches, unprefixed see all.
def fresh_repo(prefix: str) -> str:
path = tempfile.mkdtemp(prefix=prefix)
repo = git.Repo.init(path, bare=False)
with repo.config_writer() as cw:
cw.set_value("user", "email", "test@example.com")
cw.set_value("user", "name", "Test User")
repo_helper.create_commit(repo, "master", "master", "README.md", "content", f"{prefix} init")
repo_helper.create_commit(repo, "master", "ansible/master", "AN.md", "ansible", f"{prefix} ansible")
repo_helper.create_commit(repo, "master", "feature_y", "OTHER.md", "other", f"{prefix} feature")
return path
github_dir = fresh_repo("test_mixed_github_")
gitea_dir = fresh_repo("test_mixed_gitea_")
try:
clone = GitClone(remotes=[
{"name": "github", "url": github_dir, "prefix": "ansible"},
{"name": "gitea_admin", "url": gitea_dir},
])
clone.env = repo_helper.env
repo_path = clone.progress()
repo = git.Repo(repo_path)
branches = set(clone.get_branches())
# Prefixed: only ansible/master.
assert "github/ansible/master" in branches, f"missing: {branches}"
assert "github/feature_y" not in branches, f"unwanted: {branches}"
assert "github/master" not in branches, f"unwanted: {branches}"
# Unprefixed: all branches visible.
assert "gitea_admin/ansible/master" in branches, f"missing: {branches}"
assert "gitea_admin/feature_y" in branches, f"missing: {branches}"
assert "gitea_admin/master" in branches, f"missing: {branches}"
finally:
shutil.rmtree(github_dir, ignore_errors=True)
shutil.rmtree(gitea_dir, ignore_errors=True)
def test_git_clone_remotes_prefix_validation(self) -> None:
# `prefix` must be a string when set; non-string raises ValueError.
with pytest.raises(ValueError, match="'prefix' must be a string"):
GitClone(remotes=[
{"name": "github", "url": "git@example.com:a/b.git", "prefix": 123},
])
with pytest.raises(ValueError, match="'prefix' must be a string"):
GitClone(remotes=[
{"name": "github", "url": "git@example.com:a/b.git", "prefix": ["ansible"]},
])
# Empty string / None: accepted, treated as no prefix.
c1 = GitClone(remotes=[{"name": "github", "url": "git@example.com:a/b.git", "prefix": ""}])
assert c1.remotes[0]["prefix"] == ""
c2 = GitClone(remotes=[{"name": "github", "url": "git@example.com:a/b.git"}])
assert c2.remotes[0]["prefix"] == ""
def test_checkout_merged_one_branch(self, repo_helper: RemoteRepoHelper) -> None:
# Create main branch with initial commit
commit1 = repo_helper.create_commit(repo_helper.repo, "master", "master", "file1.txt", "content1",