Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6dfc870

Browse files
committed
No need to create the lock file beforehand
1 parent547e6f0 commit6dfc870

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

‎git/util.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -564,20 +564,14 @@ def _obtain_lock_or_raise(self):
564564

565565
lock_file=self._lock_file_path()
566566

567-
# Createlockfile
567+
# Create file and lock
568568
try:
569-
open(lock_file,'a').close()
570-
exceptOSErrorase:
571-
# Silence error only if file exists
572-
ife.errno!=17:# 17 -> File exists
573-
raise
574-
575-
try:
576-
fd=os.open(lock_file,os.O_WRONLY,0)
577-
flock(fd,LOCK_EX|LOCK_NB)
569+
fd=os.open(lock_file,os.O_CREAT,0)
578570
exceptOSErrorase:
579571
raiseIOError(str(e))
580572

573+
flock(fd,LOCK_EX|LOCK_NB)
574+
581575
self._file_descriptor=fd
582576
self._owns_lock=True
583577

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp