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

Commitfd2c6da

Browse files
committed
Updates from review
1 parente6108c7 commitfd2c6da

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

‎git/cmd.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -488,12 +488,12 @@ def check_unsafe_options(cls, options: List[str], unsafe_options: List[str]) ->
488488
"""
489489
# Options can be of the form `foo` or `--foo bar` `--foo=bar`,
490490
# so we need to check if they start with "--foo" or if they are equal to "foo".
491-
bare_options= [
491+
bare_unsafe_options= [
492492
option.lstrip("-")
493493
foroptioninunsafe_options
494494
]
495495
foroptioninoptions:
496-
forunsafe_option,bare_optioninzip(unsafe_options,bare_options):
496+
forunsafe_option,bare_optioninzip(unsafe_options,bare_unsafe_options):
497497
ifoption.startswith(unsafe_option)oroption==bare_option:
498498
raiseUnsafeOptionError(
499499
f"{unsafe_option} is not allowed, use `allow_unsafe_options=True` to allow it."
@@ -1193,12 +1193,12 @@ def transform_kwargs(self, split_single_char_options: bool = True, **kwargs: Any
11931193
returnargs
11941194

11951195
@classmethod
1196-
def__unpack_args(cls,arg_list:Sequence[str])->List[str]:
1196+
def_unpack_args(cls,arg_list:Sequence[str])->List[str]:
11971197

11981198
outlist= []
11991199
ifisinstance(arg_list, (list,tuple)):
12001200
forarginarg_list:
1201-
outlist.extend(cls.__unpack_args(arg))
1201+
outlist.extend(cls._unpack_args(arg))
12021202
else:
12031203
outlist.append(str(arg_list))
12041204

@@ -1283,7 +1283,7 @@ def _call_process(
12831283
# Prepare the argument list
12841284

12851285
opt_args=self.transform_kwargs(**opts_kwargs)
1286-
ext_args=self.__unpack_args([aforainargsifaisnotNone])
1286+
ext_args=self._unpack_args([aforainargsifaisnotNone])
12871287

12881288
ifinsert_after_this_argisNone:
12891289
args_list=opt_args+ext_args

‎git/remote.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,12 +1029,11 @@ def pull(
10291029
self._assert_refspec()
10301030
kwargs=add_progress(kwargs,self.repo.git,progress)
10311031

1032-
ifnotallow_unsafe_protocolsandrefspec:
1033-
ifisinstance(refspec,str):
1034-
Git.check_unsafe_protocols(refspec)
1035-
else:
1036-
forrefinrefspec:
1037-
Git.check_unsafe_protocols(ref)
1032+
refspec=Git._unpack_args(refspecor [])
1033+
ifnotallow_unsafe_protocols:
1034+
forrefinrefspec:
1035+
Git.check_unsafe_protocols(ref)
1036+
10381037
ifnotallow_unsafe_options:
10391038
Git.check_unsafe_options(options=list(kwargs.keys()),unsafe_options=self.unsafe_git_pull_options)
10401039

@@ -1084,12 +1083,10 @@ def push(
10841083
be 0."""
10851084
kwargs=add_progress(kwargs,self.repo.git,progress)
10861085

1087-
ifnotallow_unsafe_protocolsandrefspec:
1088-
ifisinstance(refspec,str):
1089-
Git.check_unsafe_protocols(refspec)
1090-
else:
1091-
forrefinrefspec:
1092-
Git.check_unsafe_protocols(ref)
1086+
refspec=Git._unpack_args(refspecor [])
1087+
ifnotallow_unsafe_protocols:
1088+
forrefinrefspec:
1089+
Git.check_unsafe_protocols(ref)
10931090

10941091
ifnotallow_unsafe_options:
10951092
Git.check_unsafe_options(options=list(kwargs.keys()),unsafe_options=self.unsafe_git_push_options)

‎test/test_git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ def test_call_process_calls_execute(self, git):
3939
self.assertEqual(git.call_args, ((["git","version"],), {}))
4040

4141
deftest_call_unpack_args_unicode(self):
42-
args=Git._Git__unpack_args("Unicode€™")
42+
args=Git._unpack_args("Unicode€™")
4343
mangled_value="Unicode\u20ac\u2122"
4444
self.assertEqual(args, [mangled_value])
4545

4646
deftest_call_unpack_args(self):
47-
args=Git._Git__unpack_args(["git","log","--","Unicode€™"])
47+
args=Git._unpack_args(["git","log","--","Unicode€™"])
4848
mangled_value="Unicode\u20ac\u2122"
4949
self.assertEqual(args, ["git","log","--",mangled_value])
5050

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp