Merge branch 'master' of https://github.com/puppetlabs/puppetlabs-vcsrepo
authorvarac <varacanero@zeromail.org>
Tue, 23 Feb 2016 13:48:19 +0000 (14:48 +0100)
committervarac <varacanero@zeromail.org>
Tue, 23 Feb 2016 13:48:19 +0000 (14:48 +0100)
1  2 
lib/puppet/provider/vcsrepo/git.rb

@@@ -126,14 -187,12 +187,15 @@@ Puppet::Type.type(:vcsrepo).provide(:gi
  
    private
  
 -  # @!visibility private
 +  def valid_repo?
 +    Dir.chdir(@resource.value(:path)){ system('git rev-parse > /dev/null 2>&1')}
 +  end
 +
    def bare_git_config_exists?
 -    File.exist?(File.join(@resource.value(:path), 'config'))
 +    File.exist?(File.join(@resource.value(:path), 'config')) && valid_repo?
    end
  
+   # @!visibility private
    def clone_repository(source, path)
      check_force
      args = ['clone']
      end
    end
  
+   # @!visibility private
    def check_force
-     if path_exists?
+     if path_exists? and not path_empty?
 -      if @resource.value(:force)
 +      if @resource.value(:force) && !valid_repo?
          notice "Removing %s to replace with vcsrepo." % @resource.value(:path)
          destroy
        else