[Unison-hackers] Ignore files above a certain size

Alan Schmitt alan.schmitt at polytechnique.org
Thu Mar 7 09:04:09 EST 2013


Steve Kalkwarf writes:

> On Mar 7, 2013, at 6:21 AM, Alan Schmitt <alan.schmitt at polytechnique.org> wrote:
>
>> I've been asked to add a feature to Unison: ignore the files that are
>> greater than a certain size. I've looked at the code and it seems the
>> least invasive way to do it is to have such file create an Error during
>> update detection. What do you think of this approach?
>
> I've never been a fan of using exceptions to dictate flow control,
> which is what this sort of smells like.

I disagree: it's not an exception, it's the result of an update
detection that says the file should be skipped. Then at reconciliation
time, the file is skipped and the UI reflects it.

A cleaner way would be to introduced another update detection results
(such as Skip or something similar), but then every UI needs to be
adapted to that construct. The advantage to this second approach (which
I may tackle if I find the time, but it's an extension of the first) is
that the user could then decide to propagate the file anyway. (Thinking
about it, this is a bit trickier than that: we need both a Skip and the
normal update detection ...)

> Also, what happens if the file threshold is set to 1 MB, and between
> syncs a file grows from 500K to 1.5MB? Delete it? Leave it? Sync it
> because it used to be synchronized?

Leave it: files in Error state are skipped (just like doing a manual
skip).

> There must be another way for the user to achieve this, without adding
> a pref?

Yes, but it's cludgy: before running unison, run a script that fetches
all the files above a certain size, both on the client and on the
server, then add this list to the set of files that are ignored for this
run.

Maybe there is a simpler way, I'd gladly hear about it.

Alan


More information about the Unison-hackers mailing list