mercurial/localrepo.py
branchstable
changeset 15348 c681e478c429
parent 15321 e174353e8cda
child 15355 dbdb777502dc
--- a/mercurial/localrepo.py	Sun Oct 23 21:59:15 2011 +0200
+++ b/mercurial/localrepo.py	Sun Oct 23 16:32:27 2011 -0500
@@ -1354,6 +1354,22 @@
                     added.append(fn)
             removed = mf1.keys()
 
+        if working and modified and not self.dirstate._checklink:
+            # Symlink placeholders may get non-symlink-like contents
+            # via user error or dereferencing by NFS or Samba servers,
+            # so we filter out any placeholders that don't look like a
+            # symlink
+            sane = []
+            for f in modified:
+                if ctx2.flags(f) == 'l':
+                    d = ctx2[f].data()
+                    if len(d) >= 1024 or '\n' in d or util.binary(d):
+                        self.ui.debug('ignoring suspect symlink placeholder'
+                                      ' "%s"\n' % f)
+                        continue
+                sane.append(f)
+            modified = sane
+
         r = modified, added, removed, deleted, unknown, ignored, clean
 
         if listsubrepos: