Skip to content

Commit

Permalink
Merge pull request #1619 from HageMaster3108/bugfix/use-python-builti…
Browse files Browse the repository at this point in the history
…n-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…
  • Loading branch information
Byron committed Sep 1, 2023
2 parents 8b75434 + 70924c4 commit a1c472b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 1 addition & 5 deletions git/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -935,11 +935,7 @@ def _obtain_lock_or_raise(self) -> None:
)

try:
flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL
if is_win:
flags |= os.O_SHORT_LIVED
fd = os.open(lock_file, flags, 0)
os.close(fd)
open(lock_file, mode='w', closefd=True)
except OSError as e:
raise IOError(str(e)) from e

Expand Down
3 changes: 2 additions & 1 deletion test/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import pickle
import sys
import tempfile
from unittest import mock, skipIf, SkipTest
from unittest import mock, skipIf, SkipTest, skip

import pytest

Expand Down Expand Up @@ -251,6 +251,7 @@ def test_clone_from_with_path_contains_unicode(self):
self.fail("Raised UnicodeEncodeError")

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

0 comments on commit a1c472b

Please sign in to comment.