git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] checkout files in-place

From
Edward Thomson <ethomson@edwardthomson.com>
Date
Jun 12, 2018, 08:51 UTC
Message-ID
<20180612085119.GA5@aaaa10152750>
In-Reply-To
<CAGHpTBJFwToEwnk4P17AJ+z-55Nzc04OBbTvsbFRrkXJpfXAkQ@mail.gmail.com>
On Tue, Jun 12, 2018 at 09:13:54AM +0300, Orgad Shaneh wrote:
> Some of my colleagues use an ancient version of Source Insight, which also
> locks files for write.

If that application is locking files for writing (that is to say, it did not specify the `FILE_SHARE_WRITE` bit in the sharing modes during `CreateFile`) then this patch would not help.

Applications, generally speaking, should be locking files for write. It's the default in Win32 and .NET's file open APIs because few applications are prepared to detect and support a file changing out from underneath them in the middle of a read.

> It's less important than it was before those fixes, but it is still needed
> for users of Qt Creator 4.6 (previous versions just avoided mmap, 4.7 uses
> mmap only for system headers). Other tools on Windows might as well
> misbehave.

I don't understand what mmap'ing via `CreateFileMapping` has to do with this. It takes an existing `HANDLE` that was opened with `CreateFile`, which is where the sharing mode was supplied.

I would be surprised if there are other tools on Windows that have specified `FILE_SHARE_WRITE` but not `FILE_SHARE_DELETE`. Generally speaking, if you don't care about another process changing a file underneath you then you should specify both. If you do then you should specify neither.

I'm not saying that git shouldn't work around a bug in QT Creator - that's not my call, though I would be loathe to support this configuration option in libgit2. But I am saying that it seems like this patch doesn't have broad applicability beyond that particular tool.

-ed
Previous: Junio C HamanoNext: Orgad Shaneh
Message 12 of 13 in “checkout files in-place”
  1. checkout files in-placeClemens Buchacher, Jun 10, 2018
  2. brian m. carlsonJun 11, 2018
  3. Clemens BuchacherJun 11, 2018
  4. Junio C HamanoJun 11, 2018
  5. Clemens BuchacherJun 11, 2018
  6. Ævar Arnfjörð BjarmasonJun 11, 2018
  7. Edward ThomsonJun 11, 2018
  8. Clemens BuchacherJun 11, 2018
  9. checkout files in-placeClemens Buchacher, Jun 11, 2018
  10. Ævar Arnfjörð BjarmasonJun 11, 2018
  11. Junio C HamanoJun 11, 2018
  12. Edward ThomsonJun 12, 2018
  13. Orgad ShanehJun 13, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.