Add and remove literal files

pathspec in git has special characters that we should not trigger.
Assume every filespec as literal
This commit is contained in:
Adam Majer 2024-07-31 12:37:10 +02:00 committed by Dirk Müller
parent 479738d4b2
commit b11b3f1adb
No known key found for this signature in database

View File

@ -181,7 +181,7 @@ class Git:
# logging.warning(f"Error removing file {path}: {e}")
def add(self, filename):
self.git_run(["add", filename])
self.git_run(["add", ":(literal)" + filename])
def add_default_gitignore(self):
if not (self.path / ".gitignore").exists():
@ -242,7 +242,7 @@ class Git:
def remove(self, file: pathlib.Path):
self.git_run(
["rm", "-q", "-f", "--ignore-unmatch", file.name],
["rm", "-q", "-f", "--ignore-unmatch", ":(literal)" + file.name],
)
patterns = self.get_specific_lfs_gitattributes()
if file.name in patterns: