Patchwork mac: ignore resource fork when checking file sizes

login
register
mail settings
Submitter Matt Mackall
Date Jan. 14, 2016, 11:11 p.m.
Message ID <6896cdc85be34f4b3438.1452813096@ruin.waste.org>
Download mbox | patch
Permalink /patch/12778/
State Accepted
Delegated to: Pierre-Yves David
Headers show

Comments

Matt Mackall - Jan. 14, 2016, 11:11 p.m.
# HG changeset patch
# User Matt Mackall <mpm@selenic.com>
# Date 1452796635 21600
#      Thu Jan 14 12:37:15 2016 -0600
# Node ID 6896cdc85be34f4b343880c5a6201f8630dedb7c
# Parent  443848eece189002c542339dc1cf84f49a94c824
mac: ignore resource fork when checking file sizes

Some evil evil awful tool adds resource forks to files it's comparing.
Our Mac-specific code to do bulk stats was accidentally using "total
size" which includes those forks in the file size, causing them to be
reported as modified. This changes it to only care about the normal
data size and thus agree with what Mercurial's expecting.
Sean Farley - Jan. 14, 2016, 11:17 p.m.
Matt Mackall <mpm@selenic.com> writes:

> # HG changeset patch
> # User Matt Mackall <mpm@selenic.com>
> # Date 1452796635 21600
> #      Thu Jan 14 12:37:15 2016 -0600
> # Node ID 6896cdc85be34f4b343880c5a6201f8630dedb7c
> # Parent  443848eece189002c542339dc1cf84f49a94c824
> mac: ignore resource fork when checking file sizes
>
> Some evil evil awful tool adds resource forks to files it's comparing.
> Our Mac-specific code to do bulk stats was accidentally using "total
> size" which includes those forks in the file size, causing them to be
> reported as modified. This changes it to only care about the normal
> data size and thus agree with what Mercurial's expecting.

+1 Tested on my mac with no blow ups. Sid, maybe you can use your crazy
big repo test?
Pierre-Yves David - Jan. 17, 2016, 7:39 p.m.
On 01/14/2016 03:11 PM, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm@selenic.com>
> # Date 1452796635 21600
> #      Thu Jan 14 12:37:15 2016 -0600
> # Node ID 6896cdc85be34f4b343880c5a6201f8630dedb7c
> # Parent  443848eece189002c542339dc1cf84f49a94c824
> mac: ignore resource fork when checking file sizes

Pushed to the clowncopter, thanks.

Patch

diff -r 443848eece18 -r 6896cdc85be3 mercurial/osutil.c
--- a/mercurial/osutil.c	Wed Jan 13 15:47:37 2016 -0600
+++ b/mercurial/osutil.c	Thu Jan 14 12:37:15 2016 -0600
@@ -458,7 +458,7 @@ 
 	requested_attr.bitmapcount = ATTR_BIT_MAP_COUNT;
 	requested_attr.commonattr = (ATTR_CMN_NAME | ATTR_CMN_OBJTYPE |
 				     ATTR_CMN_MODTIME | ATTR_CMN_ACCESSMASK);
-	requested_attr.fileattr = ATTR_FILE_TOTALSIZE;
+	requested_attr.fileattr = ATTR_FILE_DATALENGTH;
 
 	*fallback = false;