Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion otdf-sdk-mgr/src/otdf_sdk_mgr/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,14 @@ def _resolve_against(
"alias": version,
"head": True,
"sha": sha,
"tag": version,
# Flattened the same way _classify_sha_match flattens a branch
# it reached by SHA: the tag becomes a single dist/<tag>/ and
# src/<tag>/ path component. A slash here nests those
# directories, and every consumer walks them one level deep --
# xtest's all_versions_of() lists dist/*/ and the go Makefile
# finds src/*/, so "feat/x" is discovered as a "feat" build
# with no cli.sh in it.
"tag": version.replace("/", "--"),
}

if infix and version.startswith(f"{infix}/"):
Expand Down
19 changes: 18 additions & 1 deletion otdf-sdk-mgr/tests/test_resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,24 @@ def test_refs_heads_non_main_branch(self):
result = resolve("js", "refs/heads/release/sdk-v0.17", None)
assert is_resolve_success(result)
assert "head" in result and result["head"] is True
assert result["tag"] == "release/sdk-v0.17"
assert result["tag"] == "release--sdk-v0.17"
assert result["sha"] == SHA40

def test_branch_by_name_flattens_slashes(self):
# Same flattening the SHA path applies, and for the same reason: the
# tag is one path component under dist/ and src/. Reached by name
# rather than by SHA, which is the shape a workflow_dispatch input
# arrives in.
ls = make_ls_remote(
(SHA40, "refs/heads/feat/DSPX-2604-createtdf-chunked"),
("d" * 40, "refs/heads/main"),
)
with patch_git(ls):
result = resolve("go", "feat/DSPX-2604-createtdf-chunked", None)
assert is_resolve_success(result)
assert result.get("head") is True
assert result["tag"] == "feat--DSPX-2604-createtdf-chunked"
assert result["alias"] == "feat/DSPX-2604-createtdf-chunked"
assert result["sha"] == SHA40


Expand Down
Loading