dirstate: don't complain about 0-length files
authorMatt Mackall <mpm@selenic.com>
Thu, 04 Jun 2009 16:21:09 -0500
changeset 8716 f3322bb29a0e
parent 8715 8c667f4c482e
child 8717 e8de59577257
dirstate: don't complain about 0-length files
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Thu Jun 04 16:21:03 2009 -0500
+++ b/mercurial/dirstate.py	Thu Jun 04 16:21:09 2009 -0500
@@ -73,9 +73,10 @@
     def _pl(self):
         try:
             st = self._opener("dirstate").read(40)
-            if len(st) == 40:
+            l = len(st)
+            if l == 40:
                 return st[:20], st[20:40]
-            if len(st) < 40:
+            elif l > 0 and l < 40:
                 raise util.Abort(_('working directory state appears damaged!'))
         except IOError, err:
             if err.errno != errno.ENOENT: raise