<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_commit(self, commit):
 """Adds the commit to the commits array if it doesn't already exist, and returns the commit's index in the array. """

        sha1 = commit.hex
        if sha1 in self._commits:
            return self._commits[sha1]
        title, separator, body = commit.message.partition("\n")
        commit = {
            'explored': False,
            'sha1': sha1,
            'name': GitUtils.abbreviate_sha1(sha1),
            'describe': GitUtils.describe(sha1),
            'refs': GitUtils.refs_to(sha1, self.repo()),
            'author_name': commit.author.name,
            'author_mail': commit.author.email,
            'author_time': commit.author.time,
            'author_offset': commit.author.offset,
            'committer_name': commit.committer.name,
            'committer_mail': commit.committer.email,
            'committer_time': commit.committer.time,
            'committer_offset': commit.committer.offset,
            # 'message': commit.message,
            'title': title,
            'separator': separator,
            'body': body.lstrip("\n"),
        }
        self._json['commits'].append(commit)
        self._commits[sha1] = len(self._json['commits']) - 1
        return self._commits[sha1]