Skip to content

Commit a1c472b

Browse files
authored
Merge pull request #1619 from HageMaster3108/bugfix/use-python-builtin-open-method-to-create-lockfile-to-workaround-docker-virtiofs-permission-issue
#1566 Creating a lock now uses python built-in "open()" method to work arou…
2 parents 8b75434 + 70924c4 commit a1c472b

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

git/util.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -935,11 +935,7 @@ def _obtain_lock_or_raise(self) -> None:
935935
)
936936

937937
try:
938-
flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL
939-
if is_win:
940-
flags |= os.O_SHORT_LIVED
941-
fd = os.open(lock_file, flags, 0)
942-
os.close(fd)
938+
open(lock_file, mode='w', closefd=True)
943939
except OSError as e:
944940
raise IOError(str(e)) from e
945941

test/test_repo.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import pickle
1414
import sys
1515
import tempfile
16-
from unittest import mock, skipIf, SkipTest
16+
from unittest import mock, skipIf, SkipTest, skip
1717

1818
import pytest
1919

@@ -251,6 +251,7 @@ def test_clone_from_with_path_contains_unicode(self):
251251
self.fail("Raised UnicodeEncodeError")
252252

253253
@with_rw_directory
254+
@skip("the referenced repository was removed, and one needs to setup a new password controlled repo under the orgs control")
254255
def test_leaking_password_in_clone_logs(self, rw_dir):
255256
password = "fakepassword1234"
256257
try:

0 commit comments

Comments
 (0)