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: [PATCHv3 0/5] Fix --recurse-submodules for submodule worktree changes Date: Wed, 3 Jan 2018 13:16:20 -0800 Message-ID: <CAGZ79kbC5tsL8R-tUBxHoZzxYiqiWwYS61F7cLfTZeb0Wu1LGA@mail.gmail.com> (raw) In-Reply-To: <xmqqo9mahdll.fsf@gitster.mtv.corp.google.com> On Wed, Jan 3, 2018 at 12:49 PM, Junio C Hamano <gitster@pobox.com> wrote: > Stefan Beller <sbeller@google.com> writes: > >> Thanks Junio for review of this series! >> The only change in this version of the series is >> >> --- a/unpack-trees.c >> +++ b/unpack-trees.c >> @@ -2140,7 +2140,7 @@ int oneway_merge(const struct cache_entry * const *src, >> update |= CE_UPDATE; >> } >> if (S_ISGITLINK(old->ce_mode) && should_update_submodules() && >> - !verify_uptodate(old, o)) >> + o->update && !verify_uptodate(old, o)) >> update |= CE_UPDATE; >> add_entry(o, old, update, 0); >> > > Sounds OK. > > I wonder why o->update is not at the very beginning of the &&-chain, > though. After all, the one above this addition begins with o->reset > && o->update *not* because of the performance concern, but primarily > due to logic flow. I.e. "if we are resetting and updating the > working tree, then..." comes first before saying "we may need to > flip CE_UPDATE bit in update variable if the file in the working > tree is not up to date and it is within a narrow checkout area". It shows that I work too much with submodules. ;) "If we have a submodule and ..." seemed to be the important part when writing the patch. > Of course, because verify_uptodate() is rather expensive, checking > o->update before that makes sense from micro-optimization's point of > view, too. I would think S_ISGITLINK, should_update_submodules as well as o->update are all on the same order of magnitude of costs (some couple number of operations) when compared to verify_uptodate (spawning processes), so as long as verify_uptodate goes last we'd be fine. > > So after thinking aloud like the above, I am reasonably sure that > you want to check o->update as the very first thing in this new if > statement. Thanks for double checking and thinking about the code base with a less submodule centric point of view. Mind to squash it locally or want me to resend? For a resend I'll wait a couple of days to see if there are more comments needing to be addressed. > >> v2: >> I dropped the patch to `same()` as I realized we only need to fix the >> oneway_merge function, the others (two, three way merge) are fine as >> they have the checks already in place. > > This is a bit flawed argument, no? Checking working tree paths > unconditionally in same(), which does not even know if we are > touching the working tree paths, is broken. Unless "they have the > checks already in place" refers to checks that bypasses calls to > same() when we are not touching working tree paths, that is, but > obviously that is not what is going on. > > Will queue. Thanks for working on this. > >
next prev parent reply index Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-12-19 22:26 [PATCH " 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 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 [this message] 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=CAGZ79kbC5tsL8R-tUBxHoZzxYiqiWwYS61F7cLfTZeb0Wu1LGA@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