##// END OF EJS Templates
localrepo: move symlink logic to workingctx
Sean Farley -
r21393:a45af4da default
parent child Browse files
Show More
@@ -1178,6 +1178,25 b' class workingctx(committablectx):'
1178 finally:
1178 finally:
1179 wlock.release()
1179 wlock.release()
1180
1180
1181 def _filtersuspectsymlink(self, files):
1182 if not files or self._repo.dirstate._checklink:
1183 return files
1184
1185 # Symlink placeholders may get non-symlink-like contents
1186 # via user error or dereferencing by NFS or Samba servers,
1187 # so we filter out any placeholders that don't look like a
1188 # symlink
1189 sane = []
1190 for f in files:
1191 if self.flags(f) == 'l':
1192 d = self[f].data()
1193 if d == '' or len(d) >= 1024 or '\n' in d or util.binary(d):
1194 self._repo.ui.debug('ignoring suspect symlink placeholder'
1195 ' "%s"\n' % f)
1196 continue
1197 sane.append(f)
1198 return sane
1199
1181 class committablefilectx(basefilectx):
1200 class committablefilectx(basefilectx):
1182 """A committablefilectx provides common functionality for a file context
1201 """A committablefilectx provides common functionality for a file context
1183 that wants the ability to commit, e.g. workingfilectx or memfilectx."""
1202 that wants the ability to commit, e.g. workingfilectx or memfilectx."""
@@ -1609,21 +1609,8 b' class localrepository(object):'
1609 added.append(fn)
1609 added.append(fn)
1610 removed = mf1.keys()
1610 removed = mf1.keys()
1611
1611
1612 if working and modified and not self.dirstate._checklink:
1612 if working:
1613 # Symlink placeholders may get non-symlink-like contents
1613 modified = ctx2._filtersuspectsymlink(modified)
1614 # via user error or dereferencing by NFS or Samba servers,
1615 # so we filter out any placeholders that don't look like a
1616 # symlink
1617 sane = []
1618 for f in modified:
1619 if ctx2.flags(f) == 'l':
1620 d = ctx2[f].data()
1621 if d == '' or len(d) >= 1024 or '\n' in d or util.binary(d):
1622 self.ui.debug('ignoring suspect symlink placeholder'
1623 ' "%s"\n' % f)
1624 continue
1625 sane.append(f)
1626 modified = sane
1627
1614
1628 r = modified, added, removed, deleted, unknown, ignored, clean
1615 r = modified, added, removed, deleted, unknown, ignored, clean
1629
1616
General Comments 0
You need to be logged in to leave comments. Login now