lib/wcc/utils.rb in danger-wcc-0.0.3 vs lib/wcc/utils.rb in danger-wcc-0.0.4
- old
+ new
@@ -100,13 +100,15 @@
# Executes a block after checking out the specified revision into a temp
# directory.
def with_revision(revision)
Dir.mktmpdir do |dir|
logger.debug "Checking out revision #{revision} into #{dir}"
- system "git --work-tree=#{dir} checkout #{revision.strip} -- ."
+ system "git worktree add #{dir} #{revision.strip}"
yield(dir)
end
+ ensure
+ system 'git worktree prune'
end
# Creates a git-format diff of the two strings by writing them to temp files
def diff_strings(a, b)
File.write('a.tmp', a)