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

Re: [RFC PATCH] merge-recursive: create new files with O_EXCL

From
Elijah Newren <newren@gmail.com>
Date
Mar 11, 2021, 18:01 UTC
Message-ID
<CABPp-BFPj4E=pOK_f=w9k_zGA+=A1F0Hv-PgYyNDdN30mXMBuw@mail.gmail.com>
In-Reply-To
<cd7c6682-7409-f72c-8751-02b70a423f83@gmail.com>
On Thu, Mar 11, 2021 at 1:58 AM Ephrim Khong <dr.khong@gmail.com> wrote:
>
> On 11.03.2021 00:01, Junio C Hamano wrote:
> > Ephrim Khong <dr.khong@gmail.com> writes:
Show 18 quoted lines
> As a side-note, the strace on the affected file also shows that git
> writes that file twice during the merge, with the same content. There
> might be some potential to further optimize merges to avoid such
> double-writes. A small example to reproduce, note how "b" is opened
> twice during the merge:
>
>   git init
>   echo "foo" > a
>   git add a
>   git commit -m "Initial commit"
>
>   git mv a b
>   git commit -m "File moved"
>
>   git checkout -b other_branch HEAD~
>   touch c && git add c && git commit -m "Some other commit"
>   strace -otrace git merge master -m "merge message"
>   grep '"b"' trace

Yeah, this is somewhat fundamental to merge-recursive's implementation design; fixing it essentially requires a rewrite. That rewrite is nearing completion; so this double-write issue will be fixed when merge-ort is complete (or for anyone who applies the patches and tries it out now).

In fact, if you don't see the permissions problems when switching branches (because branch switching uses O_EXCL?), then merge-ort almost certainly incidentally fixes that problem for you as well.

Previous: Junio C HamanoNext: brian m. carlson
Message 5 of 6 in “merge-recursive: create new files with O_EXCL”
  1. merge-recursive: create new files with O_EXCLEphrim Khong, Mar 10, 2021
  2. Junio C HamanoMar 10, 2021
  3. Ephrim KhongMar 11, 2021
  4. Junio C HamanoMar 11, 2021
  5. Elijah NewrenMar 11, 2021
  6. brian m. carlsonMar 13, 2021

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.