def add_commit_variables(traj, commit):
    """Adds commit information to the trajectory."""

    git_time_value = time.strftime('%Y_%m_%d_%Hh%Mm%Ss', time.localtime(commit.committed_date))

    git_short_name = str(commit.hexsha[0:7])
    git_commit_name = 'commit_%s_' % git_short_name
    git_commit_name = 'git.' + git_commit_name + git_time_value

    if not traj.f_contains('config.'+git_commit_name, shortcuts=False):

        git_commit_name += '.'
        # Add the hexsha
        traj.f_add_config(git_commit_name+'hexsha', commit.hexsha,
                          comment='SHA-1 hash of commit')

        # Add the description string
        traj.f_add_config(git_commit_name+'name_rev', commit.name_rev,
                          comment='String describing the commits hex sha based on '
                                  'the closest Reference')

        # Add unix epoch
        traj.f_add_config(git_commit_name+'committed_date',
                          commit.committed_date, comment='Date of commit as unix epoch seconds')

        # Add commit message
        traj.f_add_config(git_commit_name+'message', str(commit.message),
                          comment='The commit message')

        # # Add commit author
        # traj.f_add_config(git_commit_name+'committer', str(commit.committer.name),
        #                   comment='The committer of the commit')
        #
        # # Add author's email
        # traj.f_add_config(git_commit_name+'committer_email', str(commit.committer.email),
        #                   comment='Email of committer')
dataset/ETHPy150Open SmokinCaterpillar/pypet/pypet/utils/gitintegration.py/add_commit_variables/original