def user_has_fork_of_repo?
      # The API doesn't provide a simple means of checking whether a user has
      # forked a repository.

      # First, if there are no forks for the repository, return false.
      return false if @repo[:forks_count] == 0

      # Then check whether it's worth getting the list of forks
      if @repo[:forks_count] <= 100
        repo_forks = @client.forks @repo[:full_name], :per_page => 100
        repo_forks.each do |f|
          return true if f[:owner][:login] == @user[:login]
        end
      end

      # Then try to directly find a repository with the same name as the
      # repository in which the commit exists.
      potential_fork_nwo = "#{@user[:login]}/#{@repo[:name]}"
      begin
        potential_fork = @client.repository potential_fork_nwo
        if potential_fork[:fork]
          return true if potential_fork[:parent][:full_name] == @repo[:full_name]
        end
      rescue Octokit::NotFound
        # Keep going...
      end

      # Otherwise, get the user's forks and check the `parent` field of each
      # fork to see whether it matches @repo.
      @client.auto_paginate = true
      @user_repos = @client.repos
      @user_forks = @user_repos.select { |r| r[:fork] }
      @user_forks.each do |f|
        r = @client.repository f[:full_name]
        if r[:parent][:full_name] == @repo[:full_name]
          @client.auto_paginate = false
          return true
        end
      end
      @client.auto_paginate = false
      false
    end
def user_has_fork_of_repo?
      # The API doesn't provide a simple means of checking whether a user has
      # forked a repository.

      # First, if there are no forks for the repository, return false.
      return false if @repo[:forks_count] == 0

      # Then check whether it's worth getting the list of forks
      if @repo[:forks_count] <= 100
        repo_forks = @client.forks @repo[:full_name], :per_page => 100
        repo_forks.each do |f|
          return true if f[:owner][:login] == @user[:login]
        end
      end

      # Then try to directly find a repository with the same name as the
      # repository in which the commit exists.
      potential_fork_nwo = "#{@user[:login]}/#{@repo[:name]}"
      begin
        potential_fork = @client.repository potential_fork_nwo
        if potential_fork[:fork]
          return true if potential_fork[:parent][:full_name] == @repo[:full_name]
        end
      rescue Octokit::NotFound
        # Keep going...
      end

      # Otherwise, get the user's forks and check the `parent` field of each
      # fork to see whether it matches @repo.
      @client.auto_paginate = true
      @user_repos = @client.repos
      @user_forks = @user_repos.select { |r| r[:fork] }
      @user_forks.each do |f|
        r = @client.repository f[:full_name]
        if r[:parent][:full_name] == @repo[:full_name]
          @client.auto_paginate = false
          return true
        end
      end
      @client.auto_paginate = false
      false
    end
Checks whether the authenticated user has forked the repository in which
 the commit exists.

 @return [Boolean]