def analyse_commit(self, commit, ref_id, repo_id):
        message = commit.message
        author_name = commit.author.name
        author_email = commit.author.email
        committer_name = commit.committer.name
        committer_email = commit.committer.email
        size = commit.size
        sha = commit.hexsha
        authored_date = datetime.fromtimestamp(commit.authored_date).strftime("%Y-%m-%d %H:%M:%S")
        committed_date = datetime.fromtimestamp(commit.committed_date).strftime("%Y-%m-%d %H:%M:%S")
        #insert author
        author_id = self.insert_developer(author_name, author_email)
        committer_id = self.insert_developer(committer_name, committer_email)
        #insert commit
        self.insert_commit(repo_id, sha, message, author_id, committer_id, authored_date, committed_date, size)

        commit_id = self.select_commit(sha)

        #insert parents of the commit
        self.insert_commit_parents(commit.parents, commit_id, sha, repo_id)
        #insert commits in reference
        self.insert_commit_in_reference(repo_id, commit_id, ref_id)

        try:
            if self.querier.commit_has_no_parents(commit):
                for diff in self.querier.get_diffs_no_parent_commit(commit):
                    file_path = diff[0]
                    ext = self.get_ext(file_path)

                    self.insert_file(repo_id, file_path, ext, ref_id)
                    file_id = self.select_file_id(repo_id, file_path, ref_id)

                    patch_content = re.sub(r'^(\w|\W)*\n@@', '@@', diff[1])
                    stats = self.querier.get_stats_for_file(commit, file_path)
                    status = self.querier.get_status(stats, diff)

                    #insert file modification
                    last_file_modification = self.insert_file_modification(commit_id, file_id, status,
                                                                      stats[0], stats[1], stats[2],
                                                                      patch_content)
                    line_details = self.querier.get_line_details(patch_content, ext)
                    for line_detail in line_details:
                        self.insert_line_details(last_file_modification, line_detail)
            else:
                for diff in self.querier.get_diffs(commit):
                    if self.querier.is_renamed(diff):
                        if diff.rename_from:
                            file_previous = diff.rename_from
                        else:
                            file_previous = diff.diff.split('\n')[1].replace('rename from ', '')

                        ext_current = self.get_ext(file_previous)

                        if diff.rename_to:
                            file_current = diff.rename_to
                        else:
                            file_current = diff.diff.split('\n')[2].replace('rename to ', '')

                        #insert new file
                        self.insert_file(repo_id, file_current, ext_current, ref_id)

                        #get id new file
                        current_file_id = self.select_file_id(repo_id, file_current, ref_id)

                        #retrieve the id of the previous file
                        previous_file_id = self.select_file_id(repo_id, file_previous, ref_id)

                        if not previous_file_id:
                            self.logger.warning("Git2Db: previous file id not found. commit message " + commit.message)

                        if current_file_id == previous_file_id:
                            self.logger.warning("Git2Db: previous file id is equal to current file id (" + str(current_file_id) + ") " + commit.message)

                        self.insert_file_renamed(repo_id, current_file_id, previous_file_id)
                        self.insert_file_modification(commit_id, current_file_id, "renamed", 0, 0, 0, None)
                    else:
                        #insert file
                        #if the file does not have a path, it won't be inserted
                        try:
                            file_path = diff.a_blob.path
                            ext = self.get_ext(file_path)

                            stats = self.querier.get_stats_for_file(commit, file_path)
                            status = self.querier.get_status(stats, diff)

                            self.insert_file(repo_id, file_path, ext, ref_id)
                            file_id = self.select_file_id(repo_id, file_path, ref_id)

                            #insert file modification (additions, deletions)
                            patch_content = re.sub(r'^(\w|\W)*\n@@', '@@', diff.diff)
                            last_file_modification = self.insert_file_modification(commit_id, file_id, status,
                                                                              stats[0], stats[1], stats[2], patch_content)

                            line_details = self.querier.get_line_details(patch_content, ext)
                            for line_detail in line_details:
                                self.insert_line_details(last_file_modification, line_detail)
                        except:
                            self.logger.warning("Git2Db: GitPython null file path " + str(sha) + " - " + str(message))
        except __HOLE__ as e:
            self.logger.error("Git2Db: GitPython just failed on commit " + str(sha) + " - " + str(message) + ". Details: " + str(e))
        finally:
            return
dataset/ETHPy150Open SOM-Research/Gitana/git2db.py/Git2Db.analyse_commit