| |
@@ -96,7 +96,8 @@
|
| |
build_client,
|
| |
koji_config_type='config', user=None,
|
| |
dist=None, target=None, quiet=False,
|
| |
- distgit_namespaced=False, realms=None, lookaside_namespaced=False):
|
| |
+ distgit_namespaced=False, realms=None, lookaside_namespaced=False,
|
| |
+ git_excludes=None):
|
| |
"""Init the object and some configuration details."""
|
| |
|
| |
# Path to operate on, most often pwd
|
| |
@@ -215,6 +216,8 @@
|
| |
self.module_api_url = None
|
| |
# Namespaces for which retirement is blocked by default.
|
| |
self.block_retire_ns = ['rpms']
|
| |
+ # Git excludes patterns
|
| |
+ self.git_excludes = git_excludes or []
|
| |
|
| |
# Define properties here
|
| |
# Properties allow us to "lazy load" various attributes, which also means
|
| |
@@ -1543,6 +1546,8 @@
|
| |
conf_git = git.Git(os.path.join(path, git_dir))
|
| |
self._clone_config(conf_git, repo)
|
| |
|
| |
+ self._add_git_excludes(os.path.join(path, git_dir))
|
| |
+
|
| |
return
|
| |
|
| |
def get_base_repo(self, repo):
|
| |
@@ -1652,6 +1657,20 @@
|
| |
if confline:
|
| |
conf_git.config(*confline.split())
|
| |
|
| |
+ def _add_git_excludes(self, conf_dir):
|
| |
+ """
|
| |
+ Add a list of patterns from config into the config file in a git
|
| |
+ repository. This list excludes some files or dirs to be tracked by
|
| |
+ git. This list usually includes files that are automatically generated.
|
| |
+ These changes are valid just for local git repository.
|
| |
+ """
|
| |
+ git_excludes_path = os.path.join(conf_dir, '.git/info/exclude')
|
| |
+ git_excludes = GitIgnore(git_excludes_path)
|
| |
+ for item in self.git_excludes:
|
| |
+ git_excludes.add(item)
|
| |
+ git_excludes.write()
|
| |
+ self.log.debug('Git-excludes patterns were added into %s' % git_excludes_path)
|
| |
+
|
| |
def commit(self, message=None, file=None, files=[], signoff=False):
|
| |
"""Commit changes to a repository (optionally found at path)
|
| |
|
| |
Git will ignore automatically generated files. Ignored patterns can be
specified in rhpkg/fedpkg config. Patterns are applied in
'.git/info/exclude' file only when repository is cloned. And changes are
valid only for local repository.
JIRA: COMPOSE-2794
Fixes: #355
Signed-off-by: Ondrej Nosek onosek@redhat.com