Skip to content

Commit

Permalink
Check out files from Git mirrors without moving HEAD
Browse files Browse the repository at this point in the history
Avoid moving HEAD around in Git mirrors: see #11
  • Loading branch information
drrb committed Jul 16, 2014
1 parent 3eec4f4 commit 0b5a456
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/puppet_library/util/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0b5a456

Please sign in to comment.