Method: TestLauncher::Search::Git::Interface#ls_files

Defined in:
lib/test_launcher/search/git.rb

#ls_files(pattern) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/test_launcher/search/git.rb', line 16

def ls_files(pattern)
  # files in the repo and unstaged files in the status
  shell.run("git ls-files '*#{pattern}*'") +
    shell
      .run("git status --untracked-files --porcelain=v2")
      .map { |l|
        type, path = l.split(" ")
        matcher = ".*#{pattern}.*".gsub("**", "*")
        path if type == "?" && path.match(%r{#{matcher}})              }
      .compact
end