Skip to content

Commit

Permalink
fixup! skip files in gitignore
Browse files Browse the repository at this point in the history
gitignored files: change to more readable code
  • Loading branch information
hparfr committed Oct 23, 2023
1 parent 86d1d98 commit 20106f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion copier/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,10 @@ def _apply_update(self):
ignored_files = git["status", "--ignored", "--porcelain"]()
# returns "!! file1\n !! file2\n"
# extra_exclude will contain: ["file1", file2"]
extra_exclude = [filename.split('!! ').pop() for filename in ignored_files.split("\n")][:-1]
extra_exclude = [
filename.split("!! ").pop()
for filename in ignored_files.splitlines()
]
for skip_pattern in chain(
self.skip_if_exists, self.template.skip_if_exists, extra_exclude
):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_updatediff.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ def test_file_removed(tmp_path_factory: pytest.TempPathFactory) -> None:
git("tag", "2")
# Subproject updates
with local.cwd(dst):
# git ignore a file
Path(".git/info/exclude").write_text("toignore.txt")
Path(".gitignore").write_text("toignore.txt")
git("commit", "-Am", "ignore file")
with pytest.raises(
UserMessageError, match="Enable overwrite to update a subproject."
):
Expand Down

0 comments on commit 20106f7

Please sign in to comment.