Skip to content

Commit

Permalink
fix(loose): avoid unnecessary file rename on windows
Browse files Browse the repository at this point in the history
This should workaround possible permission issues.

Related to gitpython-developers/GitPython#353
  • Loading branch information
Byron committed Oct 4, 2015
1 parent 1741302 commit 2389b75
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions gitdb/db/loose.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,15 @@ def store(self, istream):
mkdir(obj_dir)
# END handle destination directory
# rename onto existing doesn't work on windows
if os.name == 'nt' and isfile(obj_path):
remove(obj_path)
# END handle win322
rename(tmp_path, obj_path)
if os.name == 'nt':
if isfile(obj_path):
remove(tmp_path)
else:
rename(tmp_path, obj_path)
# end rename only if needed
else:
rename(tmp_path, obj_path)
# END handle win32

# make sure its readable for all ! It started out as rw-- tmp file
# but needs to be rwrr
Expand Down
2 changes: 1 addition & 1 deletion gitdb/ext/smmap
Submodule smmap updated from 84929e to 18e4ae

0 comments on commit 2389b75

Please sign in to comment.