diff --git a/mknodes/basenodes/mknode/__init__.py b/mknodes/basenodes/mknode/__init__.py index e7a7047e..f16a1c20 100644 --- a/mknodes/basenodes/mknode/__init__.py +++ b/mknodes/basenodes/mknode/__init__.py @@ -366,8 +366,8 @@ def with_context( **kwargs, ): """Same as the Ctor, but auto-adds a context for the repo url (or the cwd).""" - context = contexts.ProjectContext.for_config(repo=repo_url, base_url=base_url) - return cls(*args, **kwargs, context=context) + ctx = contexts.ProjectContext.for_config(repo_url=repo_url, base_url=base_url) + return cls(*args, **kwargs, context=ctx) def to_html(self) -> str: """Convert node to HTML using the resources from node + children.""" diff --git a/mknodes/info/contexts.py b/mknodes/info/contexts.py index b69fd909..460cabbe 100644 --- a/mknodes/info/contexts.py +++ b/mknodes/info/contexts.py @@ -356,7 +356,7 @@ def for_config( include_stdlib=True, ) git_repo = reporegistry.get_repo( - str(cfg.get("repo_url", ".")), + cfg.get("repo_url") or ".", clone_depth=cfg.get("clone_depth", 100), ) folderinfo = fi.FolderInfo(git_repo.working_dir) diff --git a/mknodes/info/gitrepository.py b/mknodes/info/gitrepository.py index ff4fdfb3..3c0201fd 100644 --- a/mknodes/info/gitrepository.py +++ b/mknodes/info/gitrepository.py @@ -20,7 +20,7 @@ class GitRepository(git.Repo): """Aggregates information about a git repo.""" def __init__(self, path: str | os.PathLike | None = None, **kwargs): - super().__init__(path, **kwargs) + super().__init__(path or ".", **kwargs) # to keep a reference to a TempDirectory instance self.temp_directory: tempfile.TemporaryDirectory | None = None