From 76fd1d4119246e2958c571d1f64c5beb88a70bd4 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 18 Feb 2010 14:33:51 +0100 Subject: LockFile: release_lock now checks whether the lockfile to be removed still exists. Previously it would just fail --- lib/git/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/git/utils.py') diff --git a/lib/git/utils.py b/lib/git/utils.py index 60a4e079..5dc576be 100644 --- a/lib/git/utils.py +++ b/lib/git/utils.py @@ -166,7 +166,12 @@ class LockFile(object): """ if not self._has_lock(): return - os.remove(self._lock_file_path()) + + # if someone removed our file beforhand, lets just flag this issue + # instead of failing, to make it more usable. + lfp = self._lock_file_path() + if os.path.isfile(lfp): + os.remove(lfp) self._owns_lock = False -- cgit v1.2.1