Skip to content
Closed
Changes from all 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
Allow user to use kill_after_timeout / as_process with clone_from
The git.cmd.execute function has the ability to use the
kill_after_timeout variable, however currently the clone function has
as_process hardcoded to True.

If progress is None, we can likley rely directly on git.cmd.execute()
for process handling, which then exposes kill_after_timeout properly.

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
  • Loading branch information
pabelanger committed Oct 5, 2017
commit 4acba834e34fbf05dba00119e19a8e458f835f8b
10 changes: 4 additions & 6 deletions git/repo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,10 @@ def init(cls, path=None, mkdir=True, odbt=DefaultDBType, expand_vars=True, **kwa

@classmethod
def _clone(cls, git, url, path, odb_default_type, progress, **kwargs):
as_process = False
if progress is not None:
progress = to_progress_instance(progress)
as_process = True

odbt = kwargs.pop('odbt', odb_default_type)

Expand All @@ -917,14 +919,10 @@ def _clone(cls, git, url, path, odb_default_type, progress, **kwargs):
sep_dir = kwargs.get('separate_git_dir')
if sep_dir:
kwargs['separate_git_dir'] = Git.polish_url(sep_dir)
proc = git.clone(Git.polish_url(url), clone_path, with_extended_output=True, as_process=True,
v=True, **add_progress(kwargs, git, progress))
proc = git.clone(Git.polish_url(url), clone_path, with_extended_output=True,
as_process=as_process, v=True, **add_progress(kwargs, git, progress))
if progress:
handle_process_output(proc, None, progress.new_message_handler(), finalize_process)
else:
(stdout, stderr) = proc.communicate()
log.debug("Cmd(%s)'s unused stdout: %s", getattr(proc, 'args', ''), stdout)
finalize_process(proc, stderr=stderr)

# our git command could have a different working dir than our actual
# environment, hence we prepend its working dir if required
Expand Down