def commits(range = current_branch)
      range = parse_range range
      commits = cached_commits range

      if commits.empty?
        base_commit, raw_commits = load_commits(range)
        commits = build_commits raw_commits
        unless base_commit.nil?
          base_commit = self.class::Commit.new(self, base_commit)
          base_commit.add_child commits.last.id
          @commits[base_commit.id] = base_commit
        end
      else
        if range.first == ''
          unless commits.last.parents.empty?
            raw_commits = load_commits(''..commits.last.id).last
            commits += build_commits raw_commits[0..-2]
          end
        else
          if commits.first.id != range.last
            raw_commits = load_commits(commits.first.id..range.last).last
            commits = build_commits(raw_commits) + commits
          end
          unless commits.last.parents.include? range.first
            raw_commits = load_commits(range.first..commits.last.id).last
            commits += build_commits raw_commits
          end
        end
      end

      CommitCollection.new commits, range
    end
def commits(range = current_branch)
      range = parse_range range
      commits = cached_commits range

      if commits.empty?
        base_commit, raw_commits = load_commits(range)
        commits = build_commits raw_commits
        unless base_commit.nil?
          base_commit = self.class::Commit.new(self, base_commit)
          base_commit.add_child commits.last.id
          @commits[base_commit.id] = base_commit
        end
      else
        if range.first == ''
          unless commits.last.parents.empty?
            raw_commits = load_commits(''..commits.last.id).last
            commits += build_commits raw_commits[0..-2]
          end
        else
          if commits.first.id != range.last
            raw_commits = load_commits(commits.first.id..range.last).last
            commits = build_commits(raw_commits) + commits
          end
          unless commits.last.parents.include? range.first
            raw_commits = load_commits(range.first..commits.last.id).last
            commits += build_commits raw_commits
          end
        end
      end

      CommitCollection.new commits, range
    end
Loads all commits including their committers and authors from the given
 commit range

 @param [String, Range] range The range of commits for which the commits
        should be retrieved. This may be given as a string
        (`'master..development'`), a range (`'master'..'development'`) or
        as a single ref (`'master'`). A single ref name means all commits
        reachable from that ref.
 @return [CommitCollection] All commits from the given commit range