stephenh / mirror

A tool for real-time, two-way sync for remote (e.g. desktop/laptop) development
Apache License 2.0
391 stars 37 forks source link

Option to sync .git directory #31

Closed ajdavis closed 5 years ago

ajdavis commented 5 years ago

I tried adding "--include .git" to the "mirror client" command line but it still seems to ignore the .git directory. I understand your reasons for ignoring it by default but I'd like to sync it. Is there a way to override the default exclude rule for .git?

stephenh commented 5 years ago

Hey; there is not now, but it should be easy to add, around in here:

https://github.com/stephenh/mirror/blob/master/src/main/java/mirror/Mirror.java#L221

Something like --ignore-default-excludes.

Are you up for submitting a PR?

ajdavis commented 5 years ago

Sure! Can you help me understand something first? (My Java's rudimentary.) What is the precedence of the "include" and "exclude" rules? Where's the code that applies these rules, so I can see how they interact with each other?

ajdavis commented 5 years ago

Nevermind, I must not have been testing correctly before. It turns out that "--include .git" works as I desire. I've submitted a new test to prove that, if you'd like.

stephenh commented 5 years ago

@ajdavis haha, no worries, I had forgotten, includes do override excludes, because something might be .gitignored but for some specific reason you do want it mirrored. Thanks for reporting back!