Sha256: 9db011af18c9bbb2ad936f3e3237cf8d257e00510b6c491874a0ed16bd49d181

Contents?: true

Size: 1.05 KB

Versions: 67

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require 'avm/git/scms/git_subrepo'
require 'avm/scms/base'
require 'eac_ruby_utils/core_ext'

module Avm
  module Git
    module Scms
      class Git < ::Avm::Scms::Base
        require_sub __FILE__, include_modules: true
        include ::Comparable

        COMMIT_DIRTY_DEFAULT_MESSAGE = 'Dirty files.'

        def <=>(other)
          git_repo <=> other.git_repo
        end

        def git_repo
          @git_repo ||= ::EacGit::Local.new(path)
        end

        # @param from [Avm::Git::Scms::Git::Commit]
        # @param to [Avm::Git::Scms::Git::Commit]
        # @return [Avm::Git::Scms::Git::Interval]
        def interval(from, to)
          ::Avm::Git::Scms::Git::Interval.new(self, from, to)
        end

        # @return [Enumerable<Avm::Git::Scms::GitSubrepo>]
        def subs
          git_repo.subrepos.map do |subrepo|
            ::Avm::Git::Scms::GitSubrepo.new(subrepo.subpath.expand_path(path))
          end
        end

        def valid?
          path.join('.git').exist?
        end
      end
    end
  end
end

Version data entries

67 entries across 67 versions & 2 rubygems

Version Path
avm-git-0.12.0 lib/avm/git/scms/git.rb
eac_tools-0.54.0 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.53.0 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.52.0 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.51.0 sub/avm-git/lib/avm/git/scms/git.rb
avm-git-0.11.0 lib/avm/git/scms/git.rb
eac_tools-0.50.0 sub/avm-git/lib/avm/git/scms/git.rb