diff options
author | Ruslan Kuprieiev <kupruser@gmail.com> | 2019-09-25 21:00:30 +0300 |
---|---|---|
committer | Ruslan Kuprieiev <kupruser@gmail.com> | 2019-09-25 21:06:42 +0300 |
commit | 79b705f061b51dc151a00729b722fbdebde59f5c (patch) | |
tree | c311a1384675c191e171f8dc016387ba4c97f024 | |
parent | e8e009d1b4b860b42083132bd7722c2802e5e5d4 (diff) | |
download | gitdb-79b705f061b51dc151a00729b722fbdebde59f5c.tar.gz |
loose: rename only if needed
Our user was experiencing issue [1] when using a git repository on NTFS mount
running on Linux. The current check checks if we are running on Windows, but
it should really check if we are on NTFS. And since checking fs type is not
that trivial and not efficient, it is simpler and better to just always apply
NTFS-specific logic, since it works on other filesystems as well.
[1] https://github.com/iterative/dvc/issues/1880#issuecomment-483253764
-rw-r--r-- | gitdb/db/loose.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 192c524..53ade9f 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -225,16 +225,12 @@ class LooseObjectDB(FileDBBase, ObjectDBR, ObjectDBW): if not isdir(obj_dir): mkdir(obj_dir) # END handle destination directory - # rename onto existing doesn't work on windows - if os.name == 'nt': - if isfile(obj_path): - remove(tmp_path) - else: - rename(tmp_path, obj_path) - # end rename only if needed + # rename onto existing doesn't work on NTFS + if isfile(obj_path): + remove(tmp_path) else: rename(tmp_path, obj_path) - # END handle win32 + # end rename only if needed # make sure its readable for all ! It started out as rw-- tmp file # but needs to be rwrr |