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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 11, 2021 at 1:58 AM Ephrim Khong <dr.khong@xxxxxxxxx> wrote:
>
> On 11.03.2021 00:01, Junio C Hamano wrote:
> > Ephrim Khong <dr.khong@xxxxxxxxx> writes:

> 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.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux