File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 3636 chmod ,
3737 isfile ,
3838 remove ,
39+ rename ,
3940 dirname ,
4041 basename ,
4142 join
5253
5354import tempfile
5455import os
55- import shutil
5656import sys
57+ import time
5758
5859
5960__all__ = ('LooseObjectDB' , )
@@ -225,14 +226,18 @@ def store(self, istream):
225226 if isfile (obj_path ):
226227 remove (tmp_path )
227228 else :
228- shutil .copyfile (tmp_path , obj_path )
229- remove (tmp_path )
229+ rename (tmp_path , obj_path )
230230 tmp_path = None
231231 # end rename only if needed
232232
233233 # make sure its readable for all ! It started out as rw-- tmp file
234234 # but needs to be rwrr
235- chmod (obj_path , self .new_objects_mode )
235+ for _ in range (3 ):
236+ suppress (PermissionError ):
237+ chmod (obj_path , self .new_objects_mode )
238+ break
239+ else :
240+ raise PermissionError ("Impossible to apply `chmod` to file {}" .format (obj_path ))
236241 # END handle dry_run
237242
238243 istream .binsha = hex_to_bin (hexsha )
You can’t perform that action at this time.
0 commit comments