Commit Graph

5 Commits

Author SHA1 Message Date
Marat Radchenko
285eebdddf Revert "Stop replacing files in LFS storage when downloading them concurrently on Windows"
This reverts commit 0c8edfc097a8364819649c9ba4df2221082a8cf8.
2019-11-05 17:30:13 +03:00
Marat Radchenko
0c8edfc097 Stop replacing files in LFS storage when downloading them concurrently on Windows
On Windows, there is no way to replace file atomically. Instead, MoveFileExA:

1. Calls CreateFileA(access=Delete, shareMode=Delete)
2. Calls SetRenameInformationFile to rename file
3. Calls CloseFile

The problem is that if parallel process attempts to open destination file for reading between
steps 2 and 3, it will try to do that without shareMode=Delete and will hit a SHARING_VIOLATION error.

In practice, this race condition results in:

  Smudge error: Error opening media file.: open .git\lfs\objects\<sha>: The process cannot access the file because it is being used by another process.

There are two solutions here:

 1. Do not overwrite file if it already exists
 2. Retry reading from file if got a SHARING_VIOLATION

This commit implements option 1.

Fixes #2825 (for Windows, other OSes are race-free already). Also see #3813 and #3826.
2019-10-25 10:54:25 +03:00
brian m. carlson
08d9e836a5
tools: require cgo for Darwin CloneFile
On Darwin, we're importing "C" in the Darwin-specific file, so flag it
as requiring cgo and specify the generic file for when we're not using
cgo.  This ensures that cross-compilation continues to work without
errors.  Since this is just a performance optimization, there's
relatively little problem with not providing the CloneFile function in a
non-cgo environment.
2019-09-11 14:38:27 +00:00
Kazuki MATSUDA / 松田一樹
8c7ed55536
Add new command git lfs dedup for file system level deduplication.
Implements and closes https://github.com/git-lfs/git-lfs/issues/3740.
2019-08-19 10:44:37 +09:00
Kazuki MATSUDA / 松田一樹
268625d325
Add clone file (CloneFileByPath) on MacOS X (darwin) 2019-08-01 23:32:29 +09:00