@@ -143,6 +143,7 @@ class _GitFile(object):
# The file may have been removed already, which is ok.
if e.errno != errno.ENOENT:
raise
+ self._closed = True
def close(self):
"""Close this file, saving the lockfile over the original.
@@ -188,3 +188,10 @@ class GitFileTests(unittest.TestCase):
f.abort()
except (IOError, OSError):
self.fail()
+
+ def test_abort_close_removed(self):
+ foo = self.path('foo')
+ f = GitFile(foo, 'wb')
+ os.remove(foo+".lock")
+ f.abort()
+ self.assertTrue(f._closed)