Stop copying .git directory with module defaults
JIRA: RHELCMP-3016
Fixes: https://pagure.io/pungi/issue/1464
Signed-off-by: Haibo Lin <hlin@redhat.com>
(cherry picked from commit f518c1bb7c
)
This commit is contained in:
parent
f2fd10b0ab
commit
2c1603c414
@ -212,7 +212,9 @@ def write_module_defaults(compose):
|
|||||||
get_dir_from_scm(scm_dict, tmp_dir, compose=compose)
|
get_dir_from_scm(scm_dict, tmp_dir, compose=compose)
|
||||||
compose.log_debug("Writing module defaults")
|
compose.log_debug("Writing module defaults")
|
||||||
shutil.copytree(
|
shutil.copytree(
|
||||||
tmp_dir, compose.paths.work.module_defaults_dir(create_dir=False)
|
tmp_dir,
|
||||||
|
compose.paths.work.module_defaults_dir(create_dir=False),
|
||||||
|
ignore=shutil.ignore_patterns(".git"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -529,10 +529,11 @@ class TestGetLookasideGroups(PungiTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@mock.patch("shutil.ignore_patterns")
|
||||||
@mock.patch("shutil.copytree")
|
@mock.patch("shutil.copytree")
|
||||||
@mock.patch("pungi.phases.init.get_dir_from_scm")
|
@mock.patch("pungi.phases.init.get_dir_from_scm")
|
||||||
class TestWriteModuleDefaults(PungiTestCase):
|
class TestWriteModuleDefaults(PungiTestCase):
|
||||||
def test_clone_git(self, gdfs, ct):
|
def test_clone_git(self, gdfs, ct, igp):
|
||||||
conf = {"scm": "git", "repo": "https://pagure.io/pungi.git", "dir": "."}
|
conf = {"scm": "git", "repo": "https://pagure.io/pungi.git", "dir": "."}
|
||||||
compose = DummyCompose(self.topdir, {"module_defaults_dir": conf})
|
compose = DummyCompose(self.topdir, {"module_defaults_dir": conf})
|
||||||
|
|
||||||
@ -547,11 +548,12 @@ class TestWriteModuleDefaults(PungiTestCase):
|
|||||||
mock.call(
|
mock.call(
|
||||||
gdfs.call_args_list[0][0][1],
|
gdfs.call_args_list[0][0][1],
|
||||||
os.path.join(self.topdir, "work/global/module_defaults"),
|
os.path.join(self.topdir, "work/global/module_defaults"),
|
||||||
|
ignore=igp(".git"),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_clone_file_scm(self, gdfs, ct):
|
def test_clone_file_scm(self, gdfs, ct, igp):
|
||||||
conf = {"scm": "file", "dir": "defaults"}
|
conf = {"scm": "file", "dir": "defaults"}
|
||||||
compose = DummyCompose(self.topdir, {"module_defaults_dir": conf})
|
compose = DummyCompose(self.topdir, {"module_defaults_dir": conf})
|
||||||
compose.config_dir = "/home/releng/configs"
|
compose.config_dir = "/home/releng/configs"
|
||||||
@ -574,11 +576,12 @@ class TestWriteModuleDefaults(PungiTestCase):
|
|||||||
mock.call(
|
mock.call(
|
||||||
gdfs.call_args_list[0][0][1],
|
gdfs.call_args_list[0][0][1],
|
||||||
os.path.join(self.topdir, "work/global/module_defaults"),
|
os.path.join(self.topdir, "work/global/module_defaults"),
|
||||||
|
ignore=igp(".git"),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_clone_file_str(self, gdfs, ct):
|
def test_clone_file_str(self, gdfs, ct, igp):
|
||||||
conf = "defaults"
|
conf = "defaults"
|
||||||
compose = DummyCompose(self.topdir, {"module_defaults_dir": conf})
|
compose = DummyCompose(self.topdir, {"module_defaults_dir": conf})
|
||||||
compose.config_dir = "/home/releng/configs"
|
compose.config_dir = "/home/releng/configs"
|
||||||
@ -595,6 +598,7 @@ class TestWriteModuleDefaults(PungiTestCase):
|
|||||||
mock.call(
|
mock.call(
|
||||||
gdfs.call_args_list[0][0][1],
|
gdfs.call_args_list[0][0][1],
|
||||||
os.path.join(self.topdir, "work/global/module_defaults"),
|
os.path.join(self.topdir, "work/global/module_defaults"),
|
||||||
|
ignore=igp(".git"),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user