def get_git_commits_from_diagfile(diagfile):
    """Retrieve git commit hashes from a diagnostic file."""

    diagfile = open(diagfile, 'r')

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

    line = diagfile.readline().split()

    if (line[1] == "Castro" and line[2] == "git" and line[3] == "hash:"):
        castro_hash = line[4]

    line = diagfile.readline().split()

    if (line[1] == "AMReX" and line[2] == "git" and line[3] == "hash:"):
        amrex_hash = line[4]

    line = diagfile.readline().split()

    if (line[1] == "Microphysics" and line[2] == "git" and line[3] == "hash:"):
        microphysics_hash = line[4]

    diagfile.close()

    return [castro_hash, amrex_hash, microphysics_hash]