Allow to use CreateFile with FILE_SHARE_DELETE for O_RDONLY#4073
Allow to use CreateFile with FILE_SHARE_DELETE for O_RDONLY#4073csware wants to merge 4 commits intolibgit2:masterlibgit2/libgit2:masterfrom csware:NoLockFIlesCopy head branch name to clipboard
Conversation
|
I'm sympathetic to wanting What files are you seeing problems here? Working directory files or files in the git repository or both? Anyway. I'm very open to this, but I think that a branch that does |
|
I was experiencing the issue mainly with working tree files (when calling I focussed on the read-only part because I saw no issue with mixing I can prepare a new patch which replaces all _wopen calls with |
That was my guess - I think I would still like to see an option that you can set to enable it instead of making this the new default; it seems like it could be a very breaking change for people who expect the locking.
I don't think there's a technical problem in intermixing them, I would just like to reduce the cyclomatic complexity. Thanks for tackling this! |
|
How would you tackle the "opt-in"? |
|
I think that I would like to see There's a couple of options here. This could be as direct as: And then passing those given flags directly to Is that satisfactory for TortoiseGit? |
I see no issues so far. |
| } | ||
|
|
||
| handle = CreateFileW(buf, desired_access, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, creation_disposition, flags_and_attributes, 0); | ||
| handle = CreateFileW(buf, desired_access, git_posix_w32__windows_sharemode, NULL, creation_disposition, flags_and_attributes, 0); |
There was a problem hiding this comment.
The setting is now applied for all files. This is ok for me, but my initial attempt was to implement this only for files which are read only.
|
@ethomson Updated. |
Signed-off-by: Sven Strickroth <email@cs-ware.de>
Signed-off-by: Sven Strickroth <email@cs-ware.de>
Signed-off-by: Sven Strickroth <email@cs-ware.de>
This can prevent FILE_SHARED_VIOLATIONS when used in tools such as TortoiseGit TGitCache and FILE_SHARE_DELETE, because files can be opened w/o being locked any more. Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
This was merged in #4192 - thanks again, and sorry for the delay in getting this integrated! |
This prevents FILE_SHARED_VIOLATIONS when used in tools such as TortoiseGit TGitCache, because the file is not locked any more.
Without this commit there could be errors while operating in explorer when a file is checked (e.g. using git_repository_hashfile) in background.