Merge remote-tracking branch 'puppetlabs/master' master
authorvarac <varacanero@zeromail.org>
Wed, 28 Sep 2016 09:59:41 +0000 (11:59 +0200)
committervarac <varacanero@zeromail.org>
Wed, 28 Sep 2016 09:59:41 +0000 (11:59 +0200)
1  2 
lib/puppet/provider/vcsrepo/git.rb

@@@ -187,12 -187,9 +187,12 @@@ 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
    # @!visibility private
    def check_force
      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
        end
      elsif @resource.value(:user) and @resource.value(:user) != Facter['id'].value
        env = Etc.getpwnam(@resource.value(:user))
-       Puppet::Util::Execution.execute("git #{args.join(' ')}", :uid => @resource.value(:user), :failonfail => true, :custom_environment => {'HOME' => env['dir']})
+       Puppet::Util::Execution.execute("git #{args.join(' ')}", :uid => @resource.value(:user), :failonfail => true, :custom_environment => {'HOME' => env['dir']}, :combine => true)
      else
        git(*args)
      end