git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git <git@vger.kernel.org>, Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCHv2 4/5] unpack-trees: oneway_merge to update submodules
Date: Tue, 2 Jan 2018 15:04:16 -0800
Message-ID: <CAGZ79kaogOLj4e38aWfzOr9TwMGngDjCL9+weFm2Jm4gTtSjEA@mail.gmail.com> (raw)
In-Reply-To: <xmqqbmichws2.fsf@gitster.mtv.corp.google.com>

On Tue, Jan 2, 2018 at 11:43 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Stefan Beller <sbeller@google.com> writes:
>
>> diff --git a/unpack-trees.c b/unpack-trees.c
>> index bf8b602901..ac59524a7f 100644
>> --- a/unpack-trees.c
>> +++ b/unpack-trees.c
>> @@ -2139,6 +2139,9 @@ int oneway_merge(const struct cache_entry * const *src,
>>                           ie_match_stat(o->src_index, old, &st, CE_MATCH_IGNORE_VALID|CE_MATCH_IGNORE_SKIP_WORKTREE))
>>                               update |= CE_UPDATE;
>>               }
>> +             if (S_ISGITLINK(old->ce_mode) && should_update_submodules() &&
>> +                 !verify_uptodate(old, o))
>> +                     update |= CE_UPDATE;
>>               add_entry(o, old, update, 0);
>>               return 0;
>>       }
>
> This is more sensible than the previous one that broke same() by
> unconditionally checking the working tree state, even when the
> machinery is told not to look at the working tree.
>
> The code in the pre-context of this hunk, (i.e. the original one you
> are half-way mimicking), we realize that the original cache entry
> and the cache entry we are checking out are exactly the same and we
> overwrite when we know that the path in the working tree is dirty,
> and we are not told to "skip" that path in the working tree
> (i.e. sparse checkout).  That happens only when we are told to
> o->update and o->reset.
>
> Shouldn't we be setting the update bit only when o->update is in
> effect,

Yes, we should.

> just like we can see in the pre-context of this hunk?  I do
> not know if we need to require o->reset and/or need to pay attention
> to the skip worktree bit in this new case.

verify_uptodate takes care of the worktree bits
("o->skip_sparse_checkout && (ce->ce_flags & CE_NEW_SKIP_WORKTREE))")

o->reset is taken care of inside the nested verify_uptodate_1 function via

    ...
    else if (o->reset || ce_uptodate(ce))
        return 0;

So I'd think we only need to toss in the o->update check.

And that additional check would only be a performance optimization
as it would omit the check in case we do not want to update.
(verify_uptodate is expensive for submodules)

  reply index

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-19 22:26 [PATCH 0/5] Fix --recurse-submodules for submodule worktree changes Stefan Beller
2017-12-19 22:26 ` [PATCH 1/5] t/lib-submodule-update.sh: clarify test Stefan Beller
2017-12-19 22:26 ` [PATCH 2/5] t/lib-submodule-update.sh: Fix test ignoring ignored files in submodules Stefan Beller
2017-12-22 19:34   ` Junio C Hamano
2017-12-27 19:27     ` Stefan Beller
2017-12-19 22:26 ` [PATCH 3/5] t/lib-submodule-update.sh: add new test for submodule internal change Stefan Beller
2017-12-19 22:31   ` Jonathan Nieder
2017-12-19 22:35     ` Stefan Beller
2017-12-19 22:26 ` [PATCH 4/5] unpack-trees: Fix same() for submodules Stefan Beller
2017-12-19 22:26 ` [PATCH 5/5] submodule: submodule_move_head omits old argument in forced case Stefan Beller
2017-12-19 22:44   ` Jonathan Nieder
2017-12-19 22:54     ` Stefan Beller
2017-12-19 23:15       ` Jonathan Nieder
2017-12-20  0:01       ` Jonathan Nieder
2017-12-20 19:36         ` Stefan Beller
2017-12-20 19:38           ` Stefan Beller
2017-12-27 22:57 ` [PATCHv2 0/5] Fix --recurse-submodules for submodule worktree changes Stefan Beller
2017-12-27 22:57   ` [PATCHv2 1/5] t/helper/test-lazy-name-hash: fix compilation Stefan Beller
2017-12-27 22:57   ` [PATCHv2 2/5] t/lib-submodule-update.sh: clarify test Stefan Beller
2017-12-27 22:57   ` [PATCHv2 3/5] t/lib-submodule-update.sh: Fix test ignoring ignored files in submodules Stefan Beller
2017-12-27 22:57   ` [PATCHv2 4/5] unpack-trees: oneway_merge to update submodules Stefan Beller
2018-01-02 19:43     ` Junio C Hamano
2018-01-02 23:04       ` Stefan Beller [this message]
2018-01-03  1:12       ` [PATCHv3 0/5] Fix --recurse-submodules for submodule worktree changes Stefan Beller
2018-01-03  1:12         ` [PATCH 1/5] t/helper/test-lazy-name-hash: fix compilation Stefan Beller
2018-01-03  1:12         ` [PATCH 2/5] t/lib-submodule-update.sh: clarify test Stefan Beller
2018-01-03  1:12         ` [PATCH 3/5] t/lib-submodule-update.sh: Fix test ignoring ignored files in submodules Stefan Beller
2018-01-03  1:12         ` [PATCH 4/5] unpack-trees: oneway_merge to update submodules Stefan Beller
2018-01-03  1:12         ` [PATCH 5/5] submodule: submodule_move_head omits old argument in forced case Stefan Beller
2018-01-03 20:49         ` [PATCHv3 0/5] Fix --recurse-submodules for submodule worktree changes Junio C Hamano
2018-01-03 21:16           ` Stefan Beller
2018-01-05 20:03           ` [PATCHv4 0/4] " Stefan Beller
2018-01-05 20:03             ` [PATCHv4 1/4] t/lib-submodule-update.sh: clarify test Stefan Beller
2018-01-05 20:03             ` [PATCHv4 2/4] t/lib-submodule-update.sh: Fix test ignoring ignored files in submodules Stefan Beller
2018-01-05 20:03             ` [PATCHv4 3/4] unpack-trees: oneway_merge to update submodules Stefan Beller
2018-01-05 20:03             ` [PATCHv4 4/4] submodule: submodule_move_head omits old argument in forced case Stefan Beller
2018-01-09 22:45             ` [PATCHv4 0/4] Fix --recurse-submodules for submodule worktree changes Junio C Hamano
2017-12-27 22:57   ` [PATCHv2 5/5] submodule: submodule_move_head omits old argument in forced case Stefan Beller

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=CAGZ79kaogOLj4e38aWfzOr9TwMGngDjCL9+weFm2Jm4gTtSjEA@mail.gmail.com \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.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