diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2017-11-02 08:13:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-02 08:13:26 +0100 |
commit | bfae362363b28be9b86250eb7f6a32dac363c993 (patch) | |
tree | 619f4b21ac94415f64784e065379afd796c0b7d3 /git/repo | |
parent | 4dd14b60b112a867a2217087b7827687102b11fe (diff) | |
parent | 454fedab8ea138057cc73aa545ecb2cf0dac5b4b (diff) | |
download | gitpython-bfae362363b28be9b86250eb7f6a32dac363c993.tar.gz |
Merge pull request #686 from jeblair/issue-605
Only gc.collect() under windows
Diffstat (limited to 'git/repo')
-rw-r--r-- | git/repo/base.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/git/repo/base.py b/git/repo/base.py index 6ee95aed..7d27d6cf 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -209,9 +209,17 @@ class Repo(object): def close(self): if self.git: self.git.clear_cache() - gc.collect() + # Tempfiles objects on Windows are holding references to + # open files until they are collected by the garbage + # collector, thus preventing deletion. + # TODO: Find these references and ensure they are closed + # and deleted synchronously rather than forcing a gc + # collection. + if is_win: + gc.collect() gitdb.util.mman.collect() - gc.collect() + if is_win: + gc.collect() def __eq__(self, rhs): if isinstance(rhs, Repo): |