def get_git_commits_from_infofile(infofile):
    """Retrieve git commit hashes from a stdout file."""

    infofile = open(infofile, 'r')
    lines = infofile.readlines()
    lines = [line.split() for line in lines]

    castro_hash   = ""
    amrex_hash   = ""
    microphysics_hash = ""

    for line in lines:
        if (len(line) == 4):
            if (line[0] == "Castro" and line[1] == "git" and line[2] == "hash:"):
                castro_hash = line[3]
            elif (line[0] == "AMReX" and line[1] == "git" and line[2] == "hash:"):
                amrex_hash = line[3]
            elif (line[0] == "Microphysics" and line[1] == "git" and line[2] == "hash:"):
                microphysics_hash = line[4]

    infofile.close()

    return [castro_hash, amrex_hash, microphysics_hash]