Sha256: 73a5f3b5299a742625dc80e77ab7ac32649e45d44b3320e0d6569e6e8e030a44

Contents?: true

Size: 988 Bytes

Versions: 23

Compression:

Stored size: 988 Bytes

Contents

# frozen_string_literal: true

require 'avm/scms/commit_info'
require 'avm/git/scms/git/changed_file'
require 'eac_ruby_utils/core_ext'

module Avm
  module Git
    module Scms
      class Git < ::Avm::Scms::Base
        class CommitDirty
          enable_method_class
          # @param commit_info [Avm::Scms::CommitInfo, nil]
          common_constructor :scm, :commit_info, default: [nil]
          delegate :git_repo, :head_commit, :run_commit, to: :scm

          # @return [Avm::Git::Scms::Git::Commit,nil]
          def result
            return nil unless git_repo.dirty?

            run_commit(asserted_commit_info)
            head_commit
          end

          private

          def asserted_commit_info
            r = ::Avm::Scms::CommitInfo.assert(commit_info)
            r = r.message(COMMIT_DIRTY_DEFAULT_MESSAGE) if r.message.blank?
            git_repo.dirty_files.inject(r) { |a, e| a.path(e.absolute_path) }
          end
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
avm-git-0.18.0 lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.94.0 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
avm-git-0.17.0 lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.86.5 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
avm-git-0.16.0 lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.86.4 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.86.3 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
avm-git-0.15.0 lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.86.2 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.84.0 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.83.0 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.82.0 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
avm-git-0.14.0 lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.81.0 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.80.0 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.79.0 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.78.0 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.77.1 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.77.0 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb
eac_tools-0.76.1 sub/avm-git/lib/avm/git/scms/git/commit_dirty.rb