<commit_before>module DTK::Common; class GritAdapter; class FileAccess
  module StatusMixin
    def status()
      chdir_and_checkout do
        Status.new(@grit_repo.status)
      end
    end

    class Status < Hash
      def initialize(grit_status_obj)
        super()
        [:added,:deleted,:changed,:untracked].each do |file_state|
#          paths_with_file_state = grit_status_obj.send(file_state).map{|info|info[0]} 
          paths_with_file_state = grit_status_obj.send(file_state).map{|info|info[1].path} 
          self[file_state] = paths_with_file_state unless paths_with_file_state.empty?
        end
      end
    end
  end                                         
end; end; end<commit_msg>put in methods to check if any status changes and to shift untyracked to added<commit_after>module DTK::Common; class GritAdapter; class FileAccess
  module StatusMixin
    def status()
      chdir_and_checkout do
        Status.new(@grit_repo.status)
      end
    end

    class Status < Hash
      def initialize(grit_status_obj)
        super()
        FileStates.each do |file_state|
          paths_with_file_state = grit_status_obj.send(file_state).map{|info|info[1].path} 
          self[file_state] = paths_with_file_state unless paths_with_file_state.empty?
        end
      end
      
      def any_changes?()
        !!FileStates.find{|fs|self[fs]}
      end
      
      def shift_untracked_to_added!()
        if untracked = self.delete(:untracked)
          self[:added] = (self[:added]||[]) + untracked
        end
        self
      end

      FileStates = [:added,:deleted,:changed,:untracked]
    end
  end                                         
end; end; end
{'fraction_non_alphanumeric': 0.08703374777975133, 'fraction_numerical': 0.0017761989342806395, 'mean_word_length': 2.3072407045009786, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4317581', 'n_tokens_mistral': 526, 'n_tokens_neox': 517, 'n_words': 106}