def min_hash_length():
    """
    Determines the minimum length of an hash string for this repository
    to uniquely describe a commit.
    gitver's minimum length is 7 characters, to avoid frequent hash string
    length variations in fast-growing projects.
    """
    try:
        out = __git_raw('rev-list', '--all', '--abbrev=0',
                        '--abbrev-commit').stdout
    except ErrorReturnCode:
        return 0

    min_accepted = 7

    # build a set of commit hash lengths
    commits = {
        len(commit) for commit in out.split('\n') if len(commit) >= min_accepted
    }

    if len(commits) > 0:
        # pick the max
        return max(commits)

    return min_accepted
dataset/ETHPy150Open manuelbua/gitver/gitver/git.py/min_hash_length/original