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

Commit1731c1e

Browse files
committed
Revert "usestrings instead ofuname to detect cygwin"
This reverts commitc441316.
1 parent58f7710 commit1731c1e

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

‎git/util.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -457,24 +457,23 @@ def _is_cygwin_git(git_executable: str) -> bool:
457457
ifis_cygwinisNone:
458458
is_cygwin=False
459459
try:
460-
git_cmd=pathlib.Path(git_executable)
461-
git_dir=git_cmd.parent
462-
460+
git_dir=osp.dirname(git_executable)
463461
ifnotgit_dir:
464462
res=py_where(git_executable)
465-
git_dir=pathlib.Path(res[0]).parentifreselse""
463+
git_dir=osp.dirname(res[0])ifreselse""
466464

467-
#If it's a cygwin git, it'll have cygwin in the output of `strings git`
468-
strings_cmd=pathlib.Path(git_dir,"strings")
465+
#Just a name given, not a real path.
466+
uname_cmd=osp.join(git_dir,"uname")
469467

470-
ifnot (pathlib.Path(strings_cmd).is_file()andos.access(strings_cmd,os.X_OK)):
471-
_logger.debug(f"Failed checking if running in CYGWIN:{strings_cmd} is not an executable")
472-
_is_cygwin_cache[git_executable]=False
468+
ifnot (pathlib.Path(uname_cmd).is_file()andos.access(uname_cmd,os.X_OK)):
469+
_logger.debug(f"Failed checking if running in CYGWIN:{uname_cmd} is not an executable")
470+
_is_cygwin_cache[git_executable]=is_cygwin
473471
returnis_cygwin
474472

475-
process=subprocess.Popen([strings_cmd,git_cmd],stdout=subprocess.PIPE,text=True)
476-
strings_output,_=process.communicate()
477-
is_cygwin=any(xforxinstrings_outputif"cygwin"inx.lower())
473+
process=subprocess.Popen([uname_cmd],stdout=subprocess.PIPE,universal_newlines=True)
474+
uname_out,_=process.communicate()
475+
# retcode = process.poll()
476+
is_cygwin="CYGWIN"inuname_out
478477
exceptExceptionasex:
479478
_logger.debug("Failed checking if running in CYGWIN due to: %r",ex)
480479
_is_cygwin_cache[git_executable]=is_cygwin

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp