File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,13 @@ General
1111 a sha or ref unless cat-file is used where it must be a sha
1212* Overhaul command caching - currently its possible to create many instances of
1313 the std-in command types, as it appears they are not killed when the repo gets
14- deleted. A clear() method could already help to allow long-running programs
15- to remove cached commands after an idle time.
16-
14+ deleted.
15+ * git command on windows may be killed using the /F options which probably is like
16+ SIGKILL. This is bad as the process might be doing something, leaving the resource
17+ locked and/or in an inconsistent state. Without the /F option, git does not terminate
18+ itself, probably it listens to SIGINT which is not sent by TASKKILL. We can't really
19+ help it, but may be at some point git handles windows signals properly.
20+
1721Object
1822------
1923* DataStream method should read the data itself. This would be easy once you have
Original file line number Diff line number Diff line change 1717 'output_stream' )
1818
1919extra = {}
20- # NOTE: Execution through a shell appears to be slightly faster, but in fact
20+ # NOTE: Execution through a shell on windows appears to be slightly faster, but in fact
2121# I consider it a problem whenever complex strings are passed and *interpreted*
2222# by the shell beforehand. This can cause great confusion and reduces compatability
2323# between the OS which is why the shell should not be used ( unless it does not work
@@ -401,3 +401,16 @@ def get_object_data(self, ref):
401401 cmd .stdout .read (1 ) # finishing newlines
402402
403403 return (hexsha , typename , size , data )
404+
405+ def clear_cache (self ):
406+ """
407+ Clear all kinds of internal caches to release resources.
408+
409+ Currently persistent commands will be interrupted.
410+
411+ Returns
412+ self
413+ """
414+ self .cat_file_all = None
415+ self .cat_file_header = None
416+ return self
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ def bare_repo_creator(self):
8282 try :
8383 return func (self , rw_repo )
8484 finally :
85+ rw_repo .git .clear_cache ()
8586 shutil .rmtree (repo_dir )
8687 # END cleanup
8788 # END bare repo creator
@@ -107,6 +108,7 @@ def repo_creator(self):
107108 try :
108109 return func (self , rw_repo )
109110 finally :
111+ rw_repo .git .clear_cache ()
110112 shutil .rmtree (repo_dir )
111113 # END cleanup
112114 # END rw repo creator
@@ -179,6 +181,8 @@ def remote_repo_creator(self):
179181 try :
180182 return func (self , rw_repo , rw_remote_repo )
181183 finally :
184+ rw_repo .git .clear_cache ()
185+ rw_remote_repo .git .clear_cache ()
182186 shutil .rmtree (repo_dir )
183187 shutil .rmtree (remote_repo_dir )
184188 # END cleanup
You can’t perform that action at this time.
0 commit comments