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
eac_tools-0.86.3 sub/avm-git/lib/avm/git/scms/git.rb
avm-git-0.15.0 lib/avm/git/scms/git.rb
eac_tools-0.86.2 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.84.0 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.83.0 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.82.0 sub/avm-git/lib/avm/git/scms/git.rb
avm-git-0.14.0 lib/avm/git/scms/git.rb
eac_tools-0.81.0 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.80.0 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.79.0 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.78.0 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.77.1 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.77.0 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.76.1 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.76.0 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.75.2 sub/avm-git/lib/avm/git/scms/git.rb
avm-git-0.13.4 lib/avm/git/scms/git.rb
eac_tools-0.75.1 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.75.0 sub/avm-git/lib/avm/git/scms/git.rb
eac_tools-0.74.1 sub/avm-git/lib/avm/git/scms/git.rb