Skip to content

Instantly share code, notes, and snippets.

@mlafeldt
Created November 30, 2012 16:17
Show Gist options
  • Select an option

  • Save mlafeldt/4176746 to your computer and use it in GitHub Desktop.

Select an option

Save mlafeldt/4176746 to your computer and use it in GitHub Desktop.
Patch Berkshelf to keep a cookbook's .git folder
--- a/vendor/gems/ruby/1.9.1/gems/berkshelf-1.0.4/lib/berkshelf/berksfile.rb
+++ b/vendor/gems/ruby/1.9.1/gems/berkshelf-1.0.4/lib/berkshelf/berksfile.rb
@@ -38,10 +38,6 @@
# Dir.glob does not support backslash as a File separator
src = cb.path.to_s.gsub('\\', '/')
FileUtils.cp_r(Dir.glob(File.join(src, "*")), dest)
+
+ # Copy .git dir if present
+ git_dir = File.join(src, ".git")
+ FileUtils.cp_r(git_dir, dest) if File.exists?(git_dir)
end
FileUtils.remove_dir(path, force: true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment