From: Elijah Newren <newren@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Junio C Hamano <gitster@pobox.com>,
Git Mailing List <git@vger.kernel.org>
Subject: Re: Optimizing writes to unchanged files during merges?
Date: Fri, 13 Apr 2018 13:04:01 -0700 [thread overview]
Message-ID: <CABPp-BFZZJ=rgOYqgsxD1A-Q5AU91e-HQ6WbAsGSqNppADXySQ@mail.gmail.com> (raw)
In-Reply-To: <CA+55aFwi9pTAJT_qtv=vHLgu=B1fdXBoD96i8Y5xnbS=zrfSzg@mail.gmail.com>
On Fri, Apr 13, 2018 at 10:14 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Fri, Apr 13, 2018 at 12:02 AM, Elijah Newren <newren@gmail.com> wrote:
>> However, it turns out we have this awesome function called
>> "was_tracked(const char *path)" that was intended for answering this
>> exact question. So, assuming was_tracked() isn't buggy, the correct
>> patch for this problem would look like:
>
> Apparently that causes problems, for some odd reason.
>
> I like the notion of checking the index, but it's not clear that the
> index is reliable in the presence of renames either.
Yes, precisely. Checking the *current* index is not reliable in the
presence of renames.
Trying to use the current index as a proxy for what was in the index
before the merge started is a problem. But we had a copy of the index
before the merge started; we just discarded it at the end of
unpack_trees(). We could keep it around instead. That would also
have the benefits of making the was_dirty() checks more accurate too,
as using the mtime's in the current index as a proxy for what was in
the original index has the potential for the same kinds of problems.
>> A big series
>> including that patch was merged to master two days ago, but
>> unfortunately that exact patch was the one that caused some
>> impressively awful fireworks[1].
>
> Yeah, so this code is fragile.
>
> How about we take a completely different approach? Instead of relying
> on fragile (but clever) tests, why not rely on stupid brute force?
>
> Yeah, yeah, it's bad to be stupid, but sometimes simple and stupid
> really does work.
>
<snip>
> Comments? Because considering the problems this code has had, maybe
> "stupid" really is the right approach...
It's certainly tempting as an interim solution. I have an alternative
interim solution that I think explains well why the code here had been
fragile, and how to just implement what we want to know rather than
making approximations to it, which I just posted at [2]. But I can
see the draw of just gutting the code and replacing with simple brute
force. Long term, I think the correct solution is still Junio's
suggested rewrite[1]. My alternative is slightly closer to that
end-state, so I favor it over simple brute-force, but if others have
strong preferences here, I can be happy with either.
Elijah
[1] https://public-inbox.org/git/xmqqd147kpdm.fsf@gitster.mtv.corp.google.com/
[2] https://public-inbox.org/git/20180413195607.18091-1-newren@gmail.com/
next prev parent reply other threads:[~2018-04-13 20:04 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-12 21:14 Optimizing writes to unchanged files during merges? Linus Torvalds
2018-04-12 21:46 ` Junio C Hamano
2018-04-12 23:17 ` Junio C Hamano
2018-04-12 23:35 ` Linus Torvalds
2018-04-12 23:41 ` Linus Torvalds
2018-04-12 23:55 ` Linus Torvalds
2018-04-13 0:01 ` Linus Torvalds
2018-04-13 7:02 ` Elijah Newren
2018-04-13 17:14 ` Linus Torvalds
2018-04-13 17:39 ` Stefan Beller
2018-04-13 17:53 ` Linus Torvalds
2018-04-13 20:04 ` Elijah Newren [this message]
2018-04-13 22:27 ` Junio C Hamano
2018-04-16 1:44 ` Junio C Hamano
2018-04-16 2:03 ` Linus Torvalds
2018-04-16 16:07 ` Lars Schneider
2018-04-16 17:04 ` Ævar Arnfjörð Bjarmason
2018-04-17 17:23 ` Lars Schneider
2018-04-16 17:43 ` Jacob Keller
2018-04-16 17:45 ` Jacob Keller
2018-04-16 22:34 ` Junio C Hamano
2018-04-17 17:27 ` Lars Schneider
2018-04-17 17:43 ` Jacob Keller
2018-04-16 17:47 ` Phillip Wood
2018-04-16 20:09 ` Stefan Haller
2018-04-16 22:55 ` Elijah Newren
2018-04-16 23:03 ` Elijah Newren
2018-04-12 23:18 ` Linus Torvalds
2018-04-13 0:01 ` Elijah Newren
Reply instructions:
You may reply publicly 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='CABPp-BFZZJ=rgOYqgsxD1A-Q5AU91e-HQ6WbAsGSqNppADXySQ@mail.gmail.com' \
--to=newren@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=torvalds@linux-foundation.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).