diff hggit/gitdirstate.py @ 860:cdf46071a83f

gitdirstate: avoid an abort when a .gitignore is missing Deleting a .gitignore using 'rm' results in 'hg add' or 'hg status' aborting. For example if the top-level .gitignore is removed: > abort: No such file or directory: .gitignore This change avoids that by checking the presence of the .gitignore files.
author Mathias De Maré <mathias.demare@gmail.com>
date Mon, 16 Feb 2015 18:35:35 +0100
parents 9c6f083eecad
children c1c2af8aecb3
line wrap: on
line diff
--- a/hggit/gitdirstate.py	Fri Jan 30 11:21:26 2015 -0500
+++ b/hggit/gitdirstate.py	Mon Feb 16 18:35:35 2015 +0100
@@ -101,6 +101,8 @@
             for fn in fns:
                 d = os.path.dirname(fn)
                 fn = self.pathto(fn)
+                if not os.path.exists(fn):
+                    continue
                 fp = open(fn)
                 pats, warnings = gignorepats(None,fp,root=d)
                 for warning in warnings: