agentos-project/agentos

`pcs.Repo.def get_version_from_git()` should not care about branches

Opened this issue · 0 comments

andyk commented

Currently pcs.Repo.def get_version_from_git() will check if the local cached repo's branch is at the same commit as the same named branch on its remote repo.

This doesn't make sense when we check-out a specific githash of a remote and thus have a floating HEAD and not remote branch name.

agentos/pcs/repo.py

Lines 135 to 154 in 9e4428b

def get_version_from_git(
self,
component_identifier: ComponentIdentifier,
file_path: str,
force: bool = False,
) -> Tuple[str, str]:
"""
Given a path to a Component, this returns a git hash and GitHub repo
URL where the current version of the Component is publicly accessible.
This will raise an exception if any of the following checks are true:
1. The Component is not in a git repo.
2. The origin of this repo is not GitHub.
3. The current local branch and corresponding remote branch are not at
the same commit.
4. There are uncommitted changes locally
If ''force'' is True, checks 2, 3, and 4 above are ignored.
"""