Skip to content

Commit 76fd1d4

Browse files
committed
LockFile: release_lock now checks whether the lockfile to be removed still exists. Previously it would just fail
1 parent 180a502 commit 76fd1d4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/git/utils.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ def _release_lock(self):
166166
"""
167167
if not self._has_lock():
168168
return
169-
os.remove(self._lock_file_path())
169+
170+
# if someone removed our file beforhand, lets just flag this issue
171+
# instead of failing, to make it more usable.
172+
lfp = self._lock_file_path()
173+
if os.path.isfile(lfp):
174+
os.remove(lfp)
170175
self._owns_lock = False
171176

172177

0 commit comments

Comments
 (0)