| |
@@ -1571,7 +1571,7 @@
|
| |
|
| |
def clone(self, repo, path=None, branch=None, bare_dir=None,
|
| |
anon=False, target=None, depth=None, extra_args=None,
|
| |
- config_path=None):
|
| |
+ config_path=None, skip_hooks=None):
|
| |
"""Clone a repo, optionally check out a specific branch.
|
| |
|
| |
:param str repo: the name of the repository to clone.
|
| |
@@ -1589,6 +1589,7 @@
|
| |
:param list extra_args: additional arguments that are passed to
|
| |
the clone command.
|
| |
:param str config_path: path to the global config file
|
| |
+ :param bool skip_hooks: skip creation pre-push hook script
|
| |
"""
|
| |
|
| |
if not path:
|
| |
@@ -1644,7 +1645,8 @@
|
| |
|
| |
if not bare_dir:
|
| |
self._add_git_excludes(os.path.join(path, git_dir))
|
| |
- self._add_git_pre_push_hook(os.path.join(path, git_dir), config_path)
|
| |
+ if not skip_hooks:
|
| |
+ self._add_git_pre_push_hook(os.path.join(path, git_dir), config_path)
|
| |
|
| |
return
|
| |
|
| |
@@ -1660,7 +1662,7 @@
|
| |
return repo
|
| |
|
| |
def clone_with_dirs(self, repo, anon=False, target=None, depth=None,
|
| |
- extra_args=None, config_path=None):
|
| |
+ extra_args=None, config_path=None, skip_hooks=None):
|
| |
"""Clone a repo old style with subdirs for each branch.
|
| |
|
| |
:param str repo: name of the repository to clone.
|
| |
@@ -1673,6 +1675,7 @@
|
| |
:param list extra_args: additional arguments that are passed to
|
| |
the clone command.
|
| |
:param str config_path: path to the global config file
|
| |
+ :param bool skip_hooks: skip creation pre-push hook script
|
| |
"""
|
| |
|
| |
self._push_url = None
|
| |
@@ -1731,7 +1734,8 @@
|
| |
|
| |
# Add excludes
|
| |
self._add_git_excludes(branch_path)
|
| |
- self._add_git_pre_push_hook(branch_path, config_path)
|
| |
+ if not skip_hooks:
|
| |
+ self._add_git_pre_push_hook(branch_path, config_path)
|
| |
except (git.GitCommandError, OSError) as e:
|
| |
raise rpkgError('Could not locally clone %s from %s: %s'
|
| |
% (branch, repo_path, e))
|
| |
@@ -1820,6 +1824,8 @@
|
| |
# This file was generated by {0} when cloning the repository.
|
| |
# You can edit it to your liking or delete completely. It will not
|
| |
# be recreated.
|
| |
+ # Creating this file can be also prevented by adding an option
|
| |
+ # "skip_hooks = True" into the {0}'s config file; [{0}] section.
|
| |
|
| |
_remote="$1"
|
| |
_url="$2"
|
| |
A new option named "skip_hooks" can be added to the config file
(into the main section). It accepts boolean values and when
the option is present and set, it prevents creating the pre-push
hook script during cloning a dist-git repository.
Fixes: https://pagure.io/fedpkg/issue/515
JIRA: RHELCMP-11491
Signed-off-by: Ondrej Nosek onosek@redhat.com