private function fetchFileHistory($path, GitRepository $git)
    {
        $fileHistory = [];
        foreach ($this->fetchCommitCollectionByPath($path, $git) as $logItem) {
            // If the renaming/copy to not found in the file history, then continue the loop.
            if (\count($fileHistory) && !\in_array($logItem['to'], $fileHistory)) {
                continue;
            }

            // If the file history empty (also by the start for the detection) and the to path not exactly the same
            // with the same path, then continue the loop.
            if (($logItem['to'] !== $path) && !\count($fileHistory)) {
                continue;
            }

            $this->executeFollowDetection($logItem, $fileHistory, $git);
        }

        return $fileHistory;
    }