Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eb4083e

Browse files
committed
More unfinished changes
1 parent 3aab902 commit eb4083e

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

git/remote.py

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -833,14 +833,21 @@ def fetch(
833833
if not allow_unsafe_options:
834834
Git.check_unsafe_options(options=list(kwargs.keys()), unsafe_options=self.unsafe_git_fetch_options)
835835

836-
proc = self.repo.git.fetch(self, *args, as_process=True, with_stdout=False,
836+
proc = self.repo.git.fetch("--", self, *args, as_process=True, with_stdout=False,
837837
universal_newlines=True, v=True, **kwargs)
838838
res = self._get_fetch_info_from_stderr(proc, progress)
839839
if hasattr(self.repo.odb, 'update_cache'):
840840
self.repo.odb.update_cache()
841841
return res
842842

843-
def pull(self, refspec=None, progress=None, **kwargs):
843+
def pull(
844+
self,
845+
refspec=None,
846+
progress=None,
847+
allow_unsafe_protocols=False,
848+
allow_unsafe_options=False,
849+
**kwargs
850+
):
844851
"""Pull changes from the given branch, being the same as a fetch followed
845852
by a merge of branch with your local branch.
846853
@@ -852,14 +859,28 @@ def pull(self, refspec=None, progress=None, **kwargs):
852859
# No argument refspec, then ensure the repo's config has a fetch refspec.
853860
self._assert_refspec()
854861
kwargs = add_progress(kwargs, self.repo.git, progress)
855-
proc = self.repo.git.pull(self, refspec, with_stdout=False, as_process=True,
862+
863+
refspec = Git._unpack_args(refspec or [])
864+
if not allow_unsafe_protocols:
865+
for ref in refspec:
866+
Git.check_unsafe_protocols(ref)
867+
if not allow_unsafe_options:
868+
Git.check_unsafe_options(options=list(kwargs.keys()), unsafe_options=self.unsafe_git_pull_options)
869+
870+
proc = self.repo.git.pull("--", self, refspec, with_stdout=False, as_process=True,
856871
universal_newlines=True, v=True, **kwargs)
857872
res = self._get_fetch_info_from_stderr(proc, progress)
858873
if hasattr(self.repo.odb, 'update_cache'):
859874
self.repo.odb.update_cache()
860875
return res
861876

862-
def push(self, refspec=None, progress=None, **kwargs):
877+
def push(
878+
self,
879+
refspec=None,
880+
progress=None,
881+
allow_unsafe_protocols=False,
882+
allow_unsafe_options=False,
883+
**kwargs):
863884
"""Push changes from source branch in refspec to target branch in refspec.
864885
865886
:param refspec: see 'fetch' method
@@ -887,7 +908,15 @@ def push(self, refspec=None, progress=None, **kwargs):
887908
If the operation fails completely, the length of the returned IterableList will
888909
be null."""
889910
kwargs = add_progress(kwargs, self.repo.git, progress)
890-
proc = self.repo.git.push(self, refspec, porcelain=True, as_process=True,
911+
912+
refspec = Git._unpack_args(refspec or [])
913+
if not allow_unsafe_protocols:
914+
for ref in refspec:
915+
Git.check_unsafe_protocols(ref)
916+
if not allow_unsafe_options:
917+
Git.check_unsafe_options(options=list(kwargs.keys()), unsafe_options=self.unsafe_git_push_options)
918+
919+
proc = self.repo.git.push("--", self, refspec, porcelain=True, as_process=True,
891920
universal_newlines=True, **kwargs)
892921
return self._get_push_info(proc, progress)
893922

0 commit comments

Comments
 (0)