Skip to content

loose: rename only if needed #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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] iterative/dvc#1880 (comment)
  • Loading branch information
efiop committed Sep 25, 2019
commit 79b705f061b51dc151a00729b722fbdebde59f5c
12 changes: 4 additions & 8 deletions gitdb/db/loose.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,12 @@ def store(self, istream):
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
Expand Down