From 7403a5dd0e02fe82256cde256c7506bfa0d9cf0b Mon Sep 17 00:00:00 2001 From: whywaita Date: Mon, 14 Jun 2021 05:35:11 +0900 Subject: [PATCH 1/2] self.repo.index.remove expect OSError, So catch --- gitfs/views/current.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gitfs/views/current.py b/gitfs/views/current.py index 5e12b460..7f65edee 100644 --- a/gitfs/views/current.py +++ b/gitfs/views/current.py @@ -266,7 +266,10 @@ def _stage(self, message, add=None, remove=None): path = path.replace("{}/".format(add), "{}/".format(remove)) self.repo.index.remove(path) else: - self.repo.index.remove(remove) + try: + self.repo.index.remove(remove) + except OSError as e: + log.debug("failed to remove from cache: [{}] {}".format(e, type(e))) else: self.repo.index.remove(remove) non_empty = True From b5be3cb912002b37977d6be5dc6c2c1736d999fd Mon Sep 17 00:00:00 2001 From: whywaita Date: Mon, 14 Jun 2021 06:13:51 +0900 Subject: [PATCH 2/2] Remove blank by blank --- gitfs/repository.py | 6 +++--- gitfs/views/current.py | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gitfs/repository.py b/gitfs/repository.py index 91b75279..905edcab 100644 --- a/gitfs/repository.py +++ b/gitfs/repository.py @@ -134,7 +134,7 @@ def _sanitize(self, path): return path def push(self, upstream, branch, credentials): - """ Push changes from a branch to a remote + """Push changes from a branch to a remote Examples:: @@ -157,7 +157,7 @@ def fetch(self, upstream, branch_name, credentials): return behind def commit(self, message, author, commiter, parents=None, ref="HEAD"): - """ Wrapper for create_commit. It creates a commit from a given ref + """Wrapper for create_commit. It creates a commit from a given ref (default is HEAD) """ @@ -423,7 +423,7 @@ def remote_head(self, upstream, branch): return remote.get_object() def get_remote(self, name): - """ Retrieve a remote by name. Raise a ValueError if the remote was not + """Retrieve a remote by name. Raise a ValueError if the remote was not added to repo Examples:: diff --git a/gitfs/views/current.py b/gitfs/views/current.py index 7f65edee..01cd4300 100644 --- a/gitfs/views/current.py +++ b/gitfs/views/current.py @@ -90,9 +90,9 @@ def getattr(self, path, fh=None): @not_in("ignore", check=["path"]) def write(self, path, buf, offset, fh): """ - We don't like big big files, so we need to be really carefull - with them. First we check for offset, then for size. If any of this - is off limit, raise EFBIG error and delete the file. + We don't like big big files, so we need to be really carefull + with them. First we check for offset, then for size. If any of this + is off limit, raise EFBIG error and delete the file. """ if offset + len(buf) > self.max_size: @@ -269,7 +269,9 @@ def _stage(self, message, add=None, remove=None): try: self.repo.index.remove(remove) except OSError as e: - log.debug("failed to remove from cache: [{}] {}".format(e, type(e))) + log.debug( + "failed to remove from cache: [{}] {}".format(e, type(e)) + ) else: self.repo.index.remove(remove) non_empty = True