-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change order of include / exclude #16
Conversation
Now we can't use somethink like this: ``` rsync src dest --include=*/ --include=*.js --exclude=* -av ``` to sync only *.js" files, becouse order is first exclude, include.
Sorry for delay, thanks for your input, but what if some users are relying on the current order? i.e. something like,
to exclude all If you need different behaviour it might be better to just use the args option to get what you need? |
http://unix.stackexchange.com/questions/76237/rsync-certain-files-excluding-the-rest-ignoring-svn-directory-recursively here you have example what I meen. |
But the problem is if I reverse the order now it could likely break some people's scripts who were relying on exclude coming before include when they update with npm. You can achieve what you want right now with something like:
I agree it might have been better to have include come before exclude, but that's the way it is, and I don't want to change something fundamental now ... |
I'm not sure, but it seems to me that the sample given before by @jedrichards does not work I'd expect it to. The following command excludes all
I order to keep
Am I missing something here? |
You're right, if you want to exclude
But the problem is that If you want
I might change this in a future update ... |
I see now that I was also very narrowly minded assuming that the second scenario I mentioned was the most common one. I'll be using my own branch till a change is made. I have an idea of an implementation that would allow people to mix includes and excludes which ever way they like. You could perhaps just have one single array that contains strings that correspond to the exclude/include file format. Here's an example:
Doesn't seem too solid to me, but due to the fact that rsync users might be familiar with it I think it could be acceptable. What do you think? I'd be happy to take a shot at implementing it. |
Yeah, I was thinking it would be nice to try and have some concise syntax where people could easily define some complex exclude/include options and maintain whichever order was appropriate for their case. At the moment having rsyncwrapper decide the order is not too good :S If you fancy having a go at implementing it then please go ahead! Perhaps we could name the option something like
|
That sounds good. I'll give it a shot. On a side note: Can you give me an example of when it would be useful to have exclude before the include argument? It seems to me that with using include before exclude allows you to pretty much do anything you'd like to, and that having it the other way around is essentially useless. By default all files in the source are included, then you choose what to exclude, and then you override the exclude in certain places. It's not like you'd ever be indicating what you'd like to include and then what you'd like to exclude. |
Humm. You might be right. I was naively assuming that since include before exclude was a valid pattern, then the opposite must be true too. But reading a bit more about it, and searching the web, it seems you're right - exclude before include would never really achieve anything. So maybe the change should be to just put includes before excludes, bump the minor package version, mention it in the readme and leave it there? Or do you think there's still value in combining them into one option? |
I'd say let's just swap them and carry on till someone else asks for the discussed functionality. I certainly won't be needing it soon. |
no problem :) but i think wrote here is enough to work with it |
Now we can't use somethink like this:
to sync only *.js" files, becouse order is first exclude, include.