From b0075473705bc9154d02c2dd5c6c6d28f1635b8b Mon Sep 17 00:00:00 2001 From: Alexander Haase Date: Fri, 19 Jan 2018 19:49:55 +0100 Subject: [PATCH 1/2] Fix two-layer excludes If a submodule of a submodule should be excluded, the paths didn't match, as the current directory was already prefixed, but the submodule's attributes file dowsn't have the path, as it doesn't know it's a submodule. --- git_archive_all.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/git_archive_all.py b/git_archive_all.py index 046179f..31e42f2 100755 --- a/git_archive_all.py +++ b/git_archive_all.py @@ -326,10 +326,9 @@ def walk_git_files(self, repo_path=''): if m: submodule_path = m.group(1) - submodule_path = path.join(repo_path, submodule_path) - if self.is_file_excluded(repo_abspath, submodule_path, exclude_patterns): continue + submodule_path = path.join(repo_path, submodule_path) for submodule_file_path in self.walk_git_files(submodule_path): if self.is_file_excluded(repo_abspath, submodule_file_path, exclude_patterns): From b9a4d2724b670bfd7e713251166e517c2e8ea470 Mon Sep 17 00:00:00 2001 From: Alexander Haase Date: Fri, 19 Jan 2018 22:28:27 +0100 Subject: [PATCH 2/2] Fix excludes for files in submodules --- git_archive_all.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/git_archive_all.py b/git_archive_all.py index 31e42f2..8fd6a88 100755 --- a/git_archive_all.py +++ b/git_archive_all.py @@ -326,12 +326,14 @@ def walk_git_files(self, repo_path=''): if m: submodule_path = m.group(1) + submodule_abspath = path.join(repo_path, submodule_path) + if self.is_file_excluded(repo_abspath, submodule_path, exclude_patterns): continue - submodule_path = path.join(repo_path, submodule_path) - for submodule_file_path in self.walk_git_files(submodule_path): - if self.is_file_excluded(repo_abspath, submodule_file_path, exclude_patterns): + for submodule_file_path in self.walk_git_files(submodule_abspath): + rel_file_path = submodule_file_path.replace(repo_path, "", 1).strip("/") + if self.is_file_excluded(repo_abspath, rel_file_path, exclude_patterns): continue yield submodule_file_path