[prev in list] [next in list] [prev in thread] [next in thread] 

List:       unison-hackers
Subject:    [unison-hackers] Patch for ignorecase behavior change
From:       "Patrick Notz" <pknotz () sandia ! gov>
Date:       2004-04-30 6:44:58
Message-ID: E5B00E7E-9A71-11D8-95AC-000A958840C6 () sandia ! gov
[Download RAW message or body]

Below is a patch to 2.9.74 that changes the ignorecase behavior 
slightly.  Basically, I set the default value of ignorecase to 'true' 
if the OS is MacOS X or Win32 since this is the case for most of those 
users; it's set to 'false' for all other platforms since that's the 
most common case for those users.  However, the user can choose to 
override the default from a profile ("ignorecase=false"); using 
-ignorecase on the command line doesn't merely toggle the default so 
the user *must* use a profile to overrride it.  The change also makes 
more of the code rely only on Case.insensitive() when needed rather 
than re-iterating the OS logic each time.  I think uicommon.ml could 
still use some logic updates since there are explicit references to 
Win32 to infer case sensitivity but I don't have a windows machine to 
test it on.

I've tested this quite a bit between my PowerBook and Linux box and it 
behaves like I expect it to.  I didn't see any unit or regression tests 
to run...

The patch is pretty small so you can either apply it by hand or save it 
to a file like ignorecase.patch and patch it with "cat ignorecase.patch 
| patch -p1 -E" in the top-level director of 2.9.74.

I happily welcome any comments/suggestions/rants.

Thanks ~ Pat

Patrick Notz
Sandia National Laboratories
PO Box 5800 MS 0382
Albuquerque, NM 87185-0382


diff -u --recursive --new-file unison-2.9.74/src/case.ml 
unison-2.9.74-pkn/src/case.ml
--- unison-2.9.74/src/case.ml	Mon Apr 26 03:00:35 2004
+++ unison-2.9.74-pkn/src/case.ml	Thu Apr 29 22:20:49 2004
@@ -6,8 +6,10 @@
  (* depending on whether the local and/or remote file system is case    
       *)
  (* insensitive.  This pref is set during the initial handshake if any 
one of *)
  (* the hosts is case insensitive.                                      
       *)
+(* Set the default to be the most probable per platform and let the 
user     *)
+(* override the value in a profile if they need to.                    
       *)
  let caseInsensitiveMode =
-  Prefs.createBool "ignorecase" false
+  Prefs.createBool "ignorecase" (Util.isOSX || Util.osType = `Win32)
      "ignore upper/lowercase spelling of filenames"
      ("When set to {\\tt true}, this flag causes Unison to treat "
       ^ "filenames as case insensitive---i.e., files in the two "
diff -u --recursive --new-file unison-2.9.74/src/uicommon.ml 
unison-2.9.74-pkn/src/uicommon.ml
--- unison-2.9.74/src/uicommon.ml	Mon Apr 26 03:00:35 2004
+++ unison-2.9.74-pkn/src/uicommon.ml	Thu Apr 29 22:14:29 2004
@@ -330,7 +330,7 @@
  let architecture =
    Remote.registerRootCmd
      "architecture"
-    (fun (_,()) -> return (Util.osType, Util.isOSX))
+    (fun (_,()) -> return ( Util.osType, Case.insensitive() ))

  (* During startup the client determines the case sensitivity of each 
root.
     If any root is case insensitive, all roots must know this -- it's
diff -u --recursive --new-file unison-2.9.74/src/update.ml 
unison-2.9.74-pkn/src/update.ml
--- unison-2.9.74/src/update.ml	Mon Apr 26 03:00:35 2004
+++ unison-2.9.74-pkn/src/update.ml	Thu Apr 29 22:26:07 2004
@@ -1296,7 +1296,7 @@
    Rx.match_string badWindowsFilenameRx (Name.toString s)
  let getChildren fspath path =
    let children = Safelist.sort Name.compare (Os.childrenOf fspath 
path) in
-  if Util.osType = `Unix && Case.insensitive() && not(Util.isOSX) then
+  if Case.insensitive() then
      (* Case conflicts are possible *)
      let childStatus nm count =
        if count > 1 then




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com.  Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/26EolB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/unison-hackers/

<*> To unsubscribe from this group, send an email to:
     unison-hackers-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic