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

Add patch from to 0.3 branch.#167

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 1 commit intogitpython-developers:0.3fromwilliamgibb:0.3
Jul 2, 2014
Merged
Changes fromall 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
21 changes: 15 additions & 6 deletionsgit/util.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,6 +22,10 @@
to_bin_sha
)

# Import the user database on unix based systems
if os.name == "posix":
import pwd

__all__ = ( "stream_copy", "join_path", "to_native_path_windows", "to_native_path_linux",
"join_path_native", "Stats", "IndexFileSHA1Writer", "Iterable", "IterableList",
"BlockingLockFile", "LockFile", 'Actor', 'get_user_id', 'assure_directory_exists',
Expand DownExpand Up@@ -113,12 +117,17 @@ def assure_directory_exists(path, is_file=False):

def get_user_id():
""":return: string identifying the currently active system user as name@node
:note: user can be set with the 'USER' environment variable, usually set on windows"""
ukn = 'UNKNOWN'
username = os.environ.get('USER', os.environ.get('USERNAME', ukn))
if username == ukn and hasattr(os, 'getlogin'):
username = os.getlogin()
# END get username from login
:note: user can be set with the 'USER' environment variable, usually set on windows
:note: on unix based systems you can use the password database
to get the login name of the effective process user"""
if os.name == "posix":
username = pwd.getpwuid(os.geteuid()).pw_name
else:
ukn = 'UNKNOWN'
username = os.environ.get('USER', os.environ.get('USERNAME', ukn))
if username == ukn and hasattr(os, 'getlogin'):
username = os.getlogin()
# END get username from login
return "%s@%s" % (username, platform.node())

#} END utilities
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp