From 0b5a4567c1b5b9839268b62569700bb259574263 Mon Sep 17 00:00:00 2001 From: drrb Date: Wed, 16 Jul 2014 20:15:20 +1000 Subject: [PATCH] Check out files from Git mirrors without moving HEAD Avoid moving HEAD around in Git mirrors: see #11 --- lib/puppet_library/util/git.rb | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/puppet_library/util/git.rb b/lib/puppet_library/util/git.rb index 2127563..0f528de 100644 --- a/lib/puppet_library/util/git.rb +++ b/lib/puppet_library/util/git.rb @@ -42,22 +42,14 @@ def tags def with_tag(tag) update_cache! PuppetLibrary::Util::TempDir.use "git" do |path| - # Synchronize here, because we're moving HEAD. This can be removed when - # we work out how to update the working copy from Git without 'checkout' - @mutex.synchronize do - git "checkout -f #{tag}", path - end + git "checkout -f #{tag} .", path yield(path) end end def read_file(path, tag) update_cache! - # Synchronize here, because we're moving HEAD. This can be removed when - # we work out how to update the working copy from Git without 'checkout' - @mutex.synchronize do - git "show refs/tags/#{tag}:#{path}" - end + git "show refs/tags/#{tag}:#{path}" end def file_exists?(path, tag)