Skip to main content

GitStatus

A class representing the status of a git repository.

Attributes

AttributeTypeDescription
is_validbool = FalseWhether git repository is valid
is_tree_cleanbool = FalseWhether working tree is clean
remote_urlstr = ""Remote URL in HTTPS format
repo_dirPath = Path()Repository root directory
commit_shastr = ""Current commit SHA

Constructor

Signature

def GitStatus(
is_valid: bool = False,
is_tree_clean: bool = False,
remote_url: str = "",
repo_dir: Path = Path(),
commit_sha: str = ""
) - > null

Parameters

NameTypeDescription
is_validbool = FalseWhether the git repository is valid
is_tree_cleanbool = FalseWhether the working tree is clean
remote_urlstr = ""Remote URL in HTTPS format
repo_dirPath = Path()Repository root directory
commit_shastr = ""Current commit SHA

Methods


from_current_repo()

@classmethod
def from_current_repo() - > [GitStatus](gitstatus.md?sid=flyte_git__config_gitstatus)

Discover git information from the current repository. If Git is not installed or .git does not exist, returns GitStatus with is_valid=False.

Returns

TypeDescription
[GitStatus](gitstatus.md?sid=flyte_git__config_gitstatus)GitStatus instance with discovered git information

build_url()

@classmethod
def build_url(
path: Path | str,
line_number: int
) - > str

Build a git URL for the given path.

Parameters

NameTypeDescription
path`Pathstr`
line_numberintLine number of the code file

Returns

TypeDescription
strPath relative to repo_dir