On Mon, May 16, 2011 at 2:59 PM, Stephen Leake <[email protected]> wrote: > Stephen Leake <[email protected]> writes: > >> Nathaniel Smith <[email protected]> writes: >> >>> On Mon, May 16, 2011 at 1:23 PM, Stephen Leake >>> <[email protected]> wrote: >>>> Note that 'mv' between two drives succeeds on Windows >>> >>> Wouldn't it be easier to just enhance the POSIX move-this-file >>> function so that it checks if they're on the same filesystem (you can >>> get this from stat(2)), and then either calls rename(2) or does a >>> copy+unlink? >> >> Hmm. >> >> Yes, that would be easier. > > The issue of how to write a test for it is still relevant.
One could write reasonable tests of the "rename this file", "copy this file and then delete the original", and "are these two files on the same filesystem?" routines (this last is the trickiest, but any linux system will have a separate filesystem stat-able at '/proc', and that already gets you a fair amount of coverage; if there's something similar on OS X and maybe Solaris then that covers most systems of interest). Then the actual move-or-copy routine would be 3 lines of obviously-correct code, so testing it isn't as important. -- Nathaniel _______________________________________________ Monotone-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/monotone-devel
