Sha256: 6e81287cea43ac75894fc22df84914d8bb75d21d5d1acde4efb6fc07fdc91fa5

Contents?: true

Size: 1.23 KB

Versions: 92

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

# tau git check clean
module GitCheckClean
  # Backend method for git check clean.
  # @return [Boolean] is git workspace clean?
  def git_check_clean
    log.debug 'Checking if git workspace is clean'

    return false unless git_check_workspace

    status_unstaged = _git_check_clean_get_status_unstaged
    status_uncommitted = _git_check_clean_get_status_uncommitted
    stdout_str_status = _git_check_clean_get_str_status

    # only return true if neither unstaged nor uncommitted nor empty files
    sum = status_unstaged.exitstatus +
          status_uncommitted.exitstatus +
          stdout_str_status.length

    sum.zero?
  end

  private

  # Get git status of unstaged changes.
  def _git_check_clean_get_status_unstaged
    cmd_git_unstaged =
      config.active['cmd_git_check_clean_git_unstaged']
    try cmd_git_unstaged
  end

  # Get git status of uncommitted changes.
  def _git_check_clean_get_status_uncommitted
    cmd_git_uncommitted =
      config.active['cmd_git_check_clean_git_uncommitted']
    try cmd_git_uncommitted
  end

  # Get git status result.
  def _git_check_clean_get_str_status
    cmd_git_status =
      config.active['cmd_git_check_clean_git_status']
    run cmd_git_status
  end
end

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
takeltau-0.46.9 lib/takeltau/git/check/clean.rb
takeltau-0.46.8 lib/takeltau/git/check/clean.rb
takeltau-0.46.5 lib/takeltau/git/check/clean.rb
takeltau-0.46.1 lib/takeltau/git/check/clean.rb
takeltau-0.46.0 lib/takeltau/git/check/clean.rb
takeltau-0.45.27 lib/takeltau/git/check/clean.rb
takeltau-0.45.26 lib/takeltau/git/check/clean.rb
takeltau-0.45.24 lib/takeltau/git/check/clean.rb
takeltau-0.45.23 lib/takeltau/git/check/clean.rb
takeltau-0.45.22 lib/takeltau/git/check/clean.rb
takeltau-0.45.21 lib/takeltau/git/check/clean.rb
takeltau-0.45.19 lib/takeltau/git/check/clean.rb
takeltau-0.45.17 lib/takeltau/git/check/clean.rb
takeltau-0.45.16 lib/takeltau/git/check/clean.rb
takeltau-0.45.14 lib/takeltau/git/check/clean.rb
takeltau-0.45.13 lib/takeltau/git/check/clean.rb
takeltau-0.45.12 lib/takeltau/git/check/clean.rb
takeltau-0.45.11 lib/takeltau/git/check/clean.rb
takeltau-0.45.10 lib/takeltau/git/check/clean.rb
takeltau-0.45.9 lib/takeltau/git/check/clean.rb