diff options
| author | Sebastian Thiel <byronimo@gmail.com> | 2015-10-04 19:17:44 +0200 |
|---|---|---|
| committer | Sebastian Thiel <byronimo@gmail.com> | 2015-10-04 19:17:44 +0200 |
| commit | 2389b75280efb1a63e6ea578eae7f897fd4beb1b (patch) | |
| tree | 35d33173a16e40d0cdc79b7d157b8160d0ce9206 | |
| parent | 17413029b0f780ac94c24ab2b5f527ded6abdd2a (diff) | |
| download | gitdb-2389b75280efb1a63e6ea578eae7f897fd4beb1b.tar.gz | |
fix(loose): avoid unnecessary file rename on windows
This should workaround possible permission issues.
Related to https://github.com/gitpython-developers/GitPython/issues/353
| -rw-r--r-- | gitdb/db/loose.py | 13 | ||||
| m--------- | gitdb/ext/smmap | 0 |
2 files changed, 9 insertions, 4 deletions
diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 4732b56..1355e1c 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -226,10 +226,15 @@ class LooseObjectDB(FileDBBase, ObjectDBR, ObjectDBW): 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 diff --git a/gitdb/ext/smmap b/gitdb/ext/smmap -Subproject 84929ed811142e366d6c5916125302c1419acad +Subproject 18e4aea23644ea43657cb2e6846b6aaf78720c2 |
