From 971d8e8613698de8f7d53372a58f5e662c335750 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: May 08 2019 01:40:31 +0000 Subject: Fix clone --branches When cloning with the --branches option we first clone a bare repo locally, then clone each branch from that bare repo. Avoid adding an excludes file to the temporary bare repo (which fails because we pass the wrong path to the git dir). Add an excludes file to each branch dir. Resolves: rhbz#1707223 Signed-off-by: Todd Zullinger --- diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py index c12b52b..43bfc1d 100644 --- a/pyrpkg/__init__.py +++ b/pyrpkg/__init__.py @@ -1546,7 +1546,8 @@ class Commands(object): 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)) + if not bare_dir: + self._add_git_excludes(os.path.join(path, git_dir)) return @@ -1625,6 +1626,9 @@ class Commands(object): branch_git.config("--replace-all", "remote.%s.url" % self.default_branch_remote, giturl) + + # Add excludes + self._add_git_excludes(branch_path) except (git.GitCommandError, OSError) as e: raise rpkgError('Could not locally clone %s from %s: %s' % (branch, repo_path, e))