On Wed, Mar 07, 2007 at 03:57:10PM +0200, Diego Iastrubni wrote:
> [EMAIL PROTECTED]:~/tmp$ echo "test 123" > 1.txt
> [EMAIL PROTECTED]:~/tmp$ cp -la 1.txt 2.txt
> [EMAIL PROTECTED]:~/tmp$ echo "test 321" > 1.txt
> [EMAIL PROTECTED]:~/tmp$ diff 1.txt 2.txt
> [EMAIL PROTECTED]:~/tmp$ 
> 
> [EMAIL PROTECTED]:~/tmp$ echo "test 123" > 1.txt
> [EMAIL PROTECTED]:~/tmp$ cp -la 1.txt 2.txt
> [EMAIL PROTECTED]:~/tmp$ echo "test 1234" > 2.txt
> [EMAIL PROTECTED]:~/tmp$ diff 1.txt 2.txt
> [EMAIL PROTECTED]:~/tmp$ 
> 
> mmmm.... 
> I don't think this will work ;-)

It will, actually.
patch moves (or unlinks?) the new file before writing it.

<[EMAIL PROTECTED]> ~/t 543 % mkdir old new
<[EMAIL PROTECTED]> ~/t 544 % echo test123 > old/file1
<[EMAIL PROTECTED]> ~/t 545 % echo test321 > new/file1
<[EMAIL PROTECTED]> ~/t 546 % diff -ur old new > diff1
<[EMAIL PROTECTED]> ~/t 547 % rm -rf new
<[EMAIL PROTECTED]> ~/t 555 % cp -la old new
<[EMAIL PROTECTED]> ~/t 556 % patch -d new < diff1 
patching file file1
<[EMAIL PROTECTED]> ~/t 557 % diff -ur old new
diff -ur old/file1 new/file1
--- old/file1   2007-03-07 16:32:06.000000000 +0200
+++ new/file1   2007-03-07 16:33:46.000000000 +0200
@@ -1 +1 @@
-test123
+test321
-- 
Didi


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to