Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1566 Creating a lock now uses python built-in "open()" method to work arou… #1619

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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