Open ahdinosaur opened 11 years ago
I think the right behavior is not to overwrite an existing directory; the user of VCS::vcs_mirror can do a files promise to remove the directory if it's necessary. This is a little tricky because I can see the case for the other behavior as well. Maybe I should make it an option, "clear_existing_dir" for instance? What do you think?
I don't want to clear the existing directory completely, I want to keep all the files in the existing directory and clone a git repository on top of it that has new files and may or may not override some overlapping files. My solution came from this: http://stackoverflow.com/questions/2411031/git-how-do-i-clone-into-a-non-empty-directory.
I'll include this if it's special behavior, explicitly turned on by the user with a flag. I think the default behavior should be to disallow using an existing non-empty directory.
If you're OK with that, please submit a pull request or rebase your repo with the necessary changes, or let us know to make the changes ourselves.
Thank you!
Please test the pull request #208.
Hi, git doesn't clone if directory already exists. That wasn't okay because the repositories I wanted to mirror were sections of configuration in /etc/, not necessarily entire directories.
Here's a fix I made: https://github.com/ahdinosaur/design-center/blob/09d9045a6a4fade45f75163266393d4cec085d8c/sketches/utilities/vcs_mirror/main.cf. Probably not the best (I'm new to cfengine), but it works for me.
Thanks.