lib/capybara/screenshot/diff/vcs.rb in capybara-screenshot-diff-1.3.1 vs lib/capybara/screenshot/diff/vcs.rb in capybara-screenshot-diff-1.4.0

- old
+ new

@@ -1,16 +1,21 @@ # frozen_string_literal: true -require_relative 'os' +require_relative "os" module Capybara module Screenshot module Diff module Vcs - SILENCE_ERRORS = Os::ON_WINDOWS ? '2>nul' : '2>/dev/null' + SILENCE_ERRORS = Os::ON_WINDOWS ? "2>nul" : "2>/dev/null" def restore_git_revision(name, target_file_name) redirect_target = "#{target_file_name} #{SILENCE_ERRORS}" - `git show HEAD~0:./#{Capybara::Screenshot.screenshot_area}/#{name}.png > #{redirect_target}` + show_command = "git show HEAD~0:./#{Capybara::Screenshot.screenshot_area}/#{name}.png" + if Capybara::Screenshot.use_lfs + `#{show_command} | git lfs smudge > #{redirect_target}` + else + `#{show_command} > #{redirect_target}` + end FileUtils.rm_f(target_file_name) unless $CHILD_STATUS == 0 end def checkout_vcs(name, comparison) svn_file_name = "#{Capybara::Screenshot.screenshot_area_abs}/.svn/text-base/#{name}.png.svn-base"