git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: Jacob Keller <jacob.keller@gmail.com>
To: Stefan Beller <sbeller@google.com>
Cc: Elijah Newren <newren@gmail.com>, git <git@vger.kernel.org>
Subject: Re: submodules and merging (Was: Re: [PATCH 02/30] merge-recursive: Fix logic ordering issue)
Date: Wed, 15 Nov 2017 09:13:55 -0800
Message-ID: <CA+P7+xorpJGrn=5zTrAPVDwHLkU5vCphOrebkH_d+MxV1k1oRg@mail.gmail.com> (raw)
In-Reply-To: <CAGZ79kbRY1gY8L361o568391Efoa1epZ1dFQZcTqJiOE7EAJfw@mail.gmail.com>

On Tue, Nov 14, 2017 at 10:13 AM, Stefan Beller <sbeller@google.com> wrote:
> Thanks for your reply!
>
> On Tue, Nov 14, 2017 at 9:17 AM, Elijah Newren <newren@gmail.com> wrote:
>> On Mon, Nov 13, 2017 at 3:46 PM, Stefan Beller <sbeller@google.com> wrote:
>>> On Mon, Nov 13, 2017 at 3:39 PM, Elijah Newren <newren@gmail.com> wrote:
>>>> On Mon, Nov 13, 2017 at 2:12 PM, Stefan Beller <sbeller@google.com> wrote:
>>>>> I wanted to debug a very similar issue today just after reviewing this
>>>>> series, see
>>>>> https://public-inbox.org/git/743acc29-85bb-3773-b6a0-68d4a0b8fd63@ispras.ru/
>>>>
>>>> Oh, bleh.  That's not a D/F conflict at all, it's the code assuming
>>>> there's a D/F conflict because the entry it is processing ("sub") is a
>>>> submodule rather than a file, and it panics when it sees "a directory
>>>> in the way" -- a directory that just so happens to be named "sub" and
>>>> which is in fact the desired submodule, meaning that the working
>>>> directory is already good and needs no changes.
>>>
>>> yup, I came to find the same snippet of code to be the offender,
>>> I just haven't figured out how to fix this bug.
>>>
>>> Thanks for taking a look!
>>>
>>> As you have a lot of fresh knowledge in the merge-recursive case
>>> currently, how would we approach the fix here?
>>
>> submodules and merging looks pretty broken, to me.  Backing off from
>> the current bug and just looking at merging with submodules in
>> general, makes me a little uneasy with what I see.  I mean, just look
>> at update_file_flags, when it wants the working directory updated, the
>> code for a submodule is the following:
>>
>>     if (update_wd) {
>> <snip>
>>
>>         if (S_ISGITLINK(mode)) {
>>             /*
>>              * We may later decide to recursively descend into
>>              * the submodule directory and update its index
>>              * and/or work tree, but we do not do that now.
>>              */
>>             update_wd = 0;
>>             goto update_index;
>>         }
>>
>> So, it just doesn't put anything there, so the working directory is
>> made out-of-date immediately.  Users are happy with that?  Maybe it is
>> what makes sense, but it surprised me.
>
> Submodules are traditionally not touched by git commands and we are slowly
> trying to get that changed. Some commands have a --recurse-submodules
> flag now, including checkout, reset; merge is missing this flag as the semantics
> are hard to define sensibly, yet.
>

Yea, figuring out how to represent a conflict with submodules is
pretty challenging, especially in cases where one side has a submodule
and the other side does not.

> Yes, introducing submodules into the mix is a big mess, because
> in the tree it is recorded as if it is a file (only the top level
> entry at path/)
> but on the file system a submodule is represented as a directory
> with contents, so the conflict detection is harder, too.
>
> I had the idea of introducing a command that can "internalize"
> a submodule. This would take the tree recorded in the submodule
> commit and put it where the submodule was mounted,
> The opposite is "externalizing" a submodule, which would turn
> a tree into a submodule. (One of the many question is if it will take
> the whole history or start with a new fresh initial commit).
>
> But this line of though might be distracting from your original point,
> which was that we have so much to keep in mind when doing tree
> operations (flags, D/F conflicts, now submodules too). I wonder how
> a sensible refactoring would look like to detangle all these aspects,
> but still keeping Git fast and not overengineered.

I think given how complex a lot of these code paths are, that an
attempt to refactor it a bit to detangle some of the mess would be
well worth the time. I'd suspect it might make handling the more
complex task of actually resolving conflicts to be easier, so the
effort to clean up the code here should be worth it.

Thanks,
Jake

>
> Thanks,
> Stefan

  reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 17:17 Elijah Newren
2017-11-14 18:13 ` Stefan Beller
2017-11-15 17:13   ` Jacob Keller [this message]
2017-11-25 22:37     ` Elijah Newren
2017-11-26  5:59       ` Jacob Keller
2017-12-04 19:33         ` Stefan Beller
2017-12-04 20:16           ` Jacob Keller

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+P7+xorpJGrn=5zTrAPVDwHLkU5vCphOrebkH_d+MxV1k1oRg@mail.gmail.com' \
    --to=jacob.keller@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=newren@gmail.com \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox