MODULES-1596 - Repository repeatedly destroyed/created with force
authorMorgan Haskel <morgan@puppetlabs.com>
Fri, 26 Dec 2014 23:27:20 +0000 (15:27 -0800)
committerMorgan Haskel <morgan@puppetlabs.com>
Fri, 26 Dec 2014 23:49:52 +0000 (15:49 -0800)
commit56f25d57dfa26de618416e9bdd4a853296ffcbc1
tree46a6c7e81c71f6b91e547cc49099da503658a6f3
parent2295710e094ef849052e4b785819a1ba3a2c0fc6
MODULES-1596 - Repository repeatedly destroyed/created with force

The `retrieve` method was calling `create` and `destroy` on every run
with `force => true`. Retrieve should not be making any changes to the
system, so removed that code, and updated `working_copy_exists` to make
sure that the directory not only contains a `.git` directory, but also
if `source` is specified it also matches `#{path}/.git/config` so that
it will overwrite a git repo with a different source.

Updated tests to not check for the old broken behavior. Added a regression test.
lib/puppet/provider/vcsrepo/git.rb
lib/puppet/type/vcsrepo.rb
spec/acceptance/beaker/git/clone/negative/clone_over_different_exiting_repo.rb
spec/acceptance/clone_repo_spec.rb
spec/acceptance/modules_1596_spec.rb [new file with mode: 0644]
spec/unit/puppet/provider/vcsrepo/git_spec.rb