diff --git a/git/refs/log.py b/git/refs/log.py index 1f86356a4..9acc0e360 100644 --- a/git/refs/log.py +++ b/git/refs/log.py @@ -262,8 +262,7 @@ def to_file(self, filepath: PathLike) -> None: try: self._serialize(fp) lfd.commit() - except Exception: - # on failure it rolls back automatically, but we make it clear + except BaseException: lfd.rollback() raise # END handle change