Skip to content

Commit b6a8db5

Browse files
committed
fix: Don't try to treat files as git repos
1 parent 197cf05 commit b6a8db5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

capella_diff_tools/__main__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import datetime
77
import logging
8-
import os
98
import pathlib
109
import sys
1110
import typing as t
@@ -65,7 +64,7 @@ def main(
6564
logging.basicConfig(level="DEBUG")
6665
if "revision" in model:
6766
del model["revision"]
68-
model["path"] = _ensure_git(model["path"])
67+
_ensure_git(model)
6968
old_model = capellambse.MelodyModel(**model, revision=old_version)
7069
new_model = capellambse.MelodyModel(**model, revision=new_version)
7170

@@ -92,18 +91,19 @@ def main(
9291
report_file.write(report.generate_html(result))
9392

9493

95-
def _ensure_git(path: str | os.PathLike) -> str:
96-
proto, path = fh.split_protocol(path)
94+
def _ensure_git(model: dict[str, t.Any]) -> None:
95+
proto, path = fh.split_protocol(model["path"])
9796
if proto == "file":
9897
assert isinstance(path, pathlib.Path)
99-
path = "git+" + path.resolve().as_uri()
100-
101-
proto, _ = fh.split_protocol(path)
102-
if proto != "git":
98+
path = path.resolve()
99+
if "entrypoint" not in model and path.is_file():
100+
model["entrypoint"] = path.name
101+
path = path.parent
102+
model["path"] = "git+" + path.as_uri()
103+
elif proto != "git":
103104
raise click.Abort("The 'model' must point to a git repository")
104105

105-
assert isinstance(path, str)
106-
return path
106+
assert isinstance(model["path"], str)
107107

108108

109109
def _get_revision_info(

0 commit comments

Comments
 (0)