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
2 changes: 1 addition & 1 deletion src/specify_cli/presets/_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ def resolve_with_source(
resolved_str = str(resolved)

# Determine source attribution
if str(self.overrides_dir) in resolved_str:
if resolved.is_relative_to(self.overrides_dir):
return {"path": resolved_str, "source": "project override"}

if str(self.presets_dir) in resolved_str and self.presets_dir.exists():
Expand Down
9 changes: 9 additions & 0 deletions tests/specify_cli/presets/test_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,15 @@ def test_resolve_with_source_core(self, project_dir):
assert result["source"] == "core"
assert "spec-template.md" in result["path"]

def test_resolve_with_source_core_name_starting_with_overrides(self, project_dir):
"""A core filename sharing the overrides prefix is still core."""
core = project_dir / ".specify" / "templates" / "overrides-report.md"
core.write_text("# Core report\n")

result = PresetResolver(project_dir).resolve_with_source("overrides-report")

assert result == {"path": str(core), "source": "core"}

def test_resolve_with_source_override(self, project_dir):
"""Test resolve_with_source for override template."""
overrides_dir = project_dir / ".specify" / "templates" / "overrides"
Expand Down
Loading