Re: More problems...
- From
- Anton Altaparmakov <aia21@cam.ac.uk>
- Date
- Apr 29, 2005, 21:57 UTC
- Message-ID
- <Pine.LNX.4.60.0504292254430.25700@hermes-1.csi.cam.ac.uk>
- In-Reply-To
- <20050429221903.F30010@flint.arm.linux.org.uk>
On Fri, 29 Apr 2005, Russell King wrote:
Show 17 quoted lines
> On Fri, Apr 29, 2005 at 02:07:29PM -0700, Junio C Hamano wrote: > > >>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes: > > LT> Absolutely. I use the same "git-pull-script" between two local directories > > LT> on disk... > > LT> Of course, I don't bother with the linking. But that's the trivial part. > > > > Would it be useful if somebody wrote local-pull.c similar to > > http-pull.c, which clones one local SHA_FILE_DIRECTORY to > > another, with an option to (1) try hardlink and if it fails > > fail; (2) try hardlink and if it fails try symlink and if it > > fails fail; (3) try hardlink and if it fails try copy and if it > > fails fail? > > What would be nice is if it finds an existing file for the one it's > trying to hard link, it compares the contents (maybe - is this actually > necessary?) and if identical, it removes the original file replacing > it with a hard link.
Unless I have completely misunderstood things, you never need to compare the file contents. Just compare the file names. If they match, i.e. the SHA1 is the same, the contents must match by definition. So you only need a stat(), rather than read&decompress&compare.
> This means that you'll always be trying to maintain the hard linked > structure between various working trees in the background. > > But maybe this should have an option to enable this behaviour.
There should definitely be an option to either enable or disable this as there are legitimate cases for not wanting hard links or indeed using file systems which do not support them.
Best regards,
Anton
-- Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/