File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 9
9
from .compat import is_win
10
10
import contextlib
11
11
from functools import wraps
12
- import getpass
13
12
import logging
14
13
import os
15
14
import platform
15
+ import pwd
16
16
import subprocess
17
17
import re
18
18
import shutil
@@ -410,7 +410,8 @@ def is_cygwin_git(git_executable: Union[None, PathLike]) -> bool:
410
410
411
411
def get_user_id () -> str :
412
412
""":return: string identifying the currently active system user as name@node"""
413
- return "%s@%s" % (getpass .getuser (), platform .node ())
413
+ user = pwd .getpwuid (os .geteuid ()).pw_name
414
+ return "%s@%s" % (user , platform .node ())
414
415
415
416
416
417
def finalize_process (proc : Union [subprocess .Popen , "Git.AutoInterrupt" ], ** kwargs : Any ) -> None :
@@ -750,7 +751,7 @@ def _main_actor(
750
751
config_reader : Union [None , "GitConfigParser" , "SectionConstraint" ] = None ,
751
752
) -> "Actor" :
752
753
actor = Actor ("" , "" )
753
- user_id = None # We use this to avoid multiple calls to getpass.getuser()
754
+ user_id = None # We use this to avoid multiple calls to resolve the user
754
755
755
756
def default_email () -> str :
756
757
nonlocal user_id
You can’t perform that action at this time.
0 commit comments