From eba3fece9104b8ca5275ae340038a4cc81ee3c4e Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Wed, 31 Jul 2024 12:37:10 +0200 Subject: [PATCH] Add and remove literal files pathspec in git has special characters that we should not trigger. Assume every filespec as literal --- lib/git.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/git.py b/lib/git.py index 6a358c5..c822ce7 100644 --- a/lib/git.py +++ b/lib/git.py @@ -180,7 +180,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(): @@ -241,7 +241,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: