from pathlib import Path


def get_current_head(root: Path) -> str:
    """
    Reads the stock file and return the commit hash if found

    Parameters
    ----------
    root : Path
        The stock root path

    Returns
    -------
    str
        commit hash if found. Empty string other wises
    """
    with open(root/'head.stock', 'r') as f:
        commit = f.read()
        return commit if commit else ''