[Unison-hackers] treating some directories atomically, and ignoring socket files

Julian Squires julian at cipht.net
Thu Jan 1 10:42:22 EST 2015


Hi,

I was contacted by a client to add two features to Unison for them,
and although I implemented something that worked for them, I'd like to
ask here about how to approach their implementation in a way that
might be accepted upstream.

The first is to ignore Unix domain socket files, which I did by
returning `ABSENT in Fileinfo.get when such a file is encountered.
I've attached some patches for this, but I realized later that my test
could be cleaner, as I didn't fully understand the test scaffold when
I first approached it.

The second is to treat VCS directories (such as .git or .svn)
atomically; that is, all the changes under such a directory should be
reconciled in the same direction, not merged.

For this feature, I provided a workaround for the client that adds a
predicate preference "atomic" which specifies directories to treat in
this manner, and then in Update.buildUpdateRec I treat anything within
those directories as new if there's been any change.  This seems to
work for them, but is clearly pretty inelegant and far from the
cleanest solution.

I had the suspicion that the best-integrated solution would be to
create a new file type like `ATOMIC_DIRECTORY so that the UI could
present it as a single entry, but it would be otherwise processed like
a directory.

I suspect that this would be too invasive a change for such a patch to
ever get merged upstream, though, which is why I'm hoping the members
of this list will have some suggestions.

I've attached patches for ignoring Unix socket files, which may need
some changes, but is probably otherwise uncontroversial.

Thanks,

-- 
Julian Squires
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-Unix-domain-sockets-test-scaffold.patch
Type: text/x-diff
Size: 1992 bytes
Desc: not available
URL: <http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20150101/0e2844eb/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-trivial-test-for-Unix-sockets.patch
Type: text/x-diff
Size: 992 bytes
Desc: not available
URL: <http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20150101/0e2844eb/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Ignore-socket-files.patch
Type: text/x-diff
Size: 716 bytes
Desc: not available
URL: <http://lists.seas.upenn.edu/pipermail/unison-hackers/attachments/20150101/0e2844eb/attachment-0005.bin>


More information about the Unison-hackers mailing list