From: "René Scharfe" <l.s.r@web.de>
To: Jeff King <peff@peff.net>
Cc: Git List <git@vger.kernel.org>,
Junio C Hamano <gitster@pobox.com>,
Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] checkout: don't write merge results into the object database
Date: Thu, 15 Jun 2017 17:48:18 +0200 [thread overview]
Message-ID: <f7d38553-484b-ee81-e059-2c737dad2bc4@web.de> (raw)
In-Reply-To: <20170615135751.qxn6bsfsxz5es236@sigill.intra.peff.net>
Am 15.06.2017 um 15:57 schrieb Jeff King:
> On Thu, Jun 15, 2017 at 01:33:42PM +0200, René Scharfe wrote:
>
>> Merge results need to be written to the worktree, of course, but we
>> don't necessarily need object entries for them, especially if they
>> contain conflict markers. Use pretend_sha1_file() to create fake
>> blobs to pass to make_cache_entry() and checkout_entry() instead.
>
> Conceptually this makes sense, although I have a comment below.
>
> Out of curiosity, did this come up when looking into the cherry-pick
> segfault/error from a few hours ago?
No, it came up in the discussion of Dscho's memory leak plug series [1].
>> @@ -225,8 +225,8 @@ static int checkout_merged(int pos, const struct checkout *state)
>> * (it also writes the merge result to the object database even
>> * when it may contain conflicts).
>> */
>> - if (write_sha1_file(result_buf.ptr, result_buf.size,
>> - blob_type, oid.hash))
>> + if (pretend_sha1_file(result_buf.ptr, result_buf.size,
>> + OBJ_BLOB, oid.hash))
>> die(_("Unable to add merge result for '%s'"), path);
>> free(result_buf.ptr);
>
> I wondered if pretend_sha1_file() makes a copy of the buffer, and indeed
> it does. So this is correct.
>
> But that raises an interesting question: how big are these objects, and
> is it a good idea to store them in RAM? Obviously they're in RAM
> already, but I'm not sure if it's one-at-a-time. We could be bumping the
> peak RAM used if there's a large number of these entries. Touching the
> on-disk odb does feel hacky, but it also means they behave like other
> objects.
>
> If it is a concern, I think it could be solved by "unpretending" after
> our call to checkout_entry completes. That would need a new call in
> sha1_file.c, but it should be easy to write.
Good point; we'd accumulate fake entries that we'll never need again.
The patch should clean them up.
Alternatively we could finally address the NEEDSWORK comment and
provide a way to checkout a file without faking an index entry..
René
[1] https://public-inbox.org/git/2704e145927c851c4163a68cfdfd5ada48fff21d.1493906085.git.johannes.schindelin@gmx.de/
next prev parent reply other threads:[~2017-06-15 15:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-15 11:33 [PATCH] checkout: don't write merge results into the object database René Scharfe
2017-06-15 13:57 ` Jeff King
2017-06-15 15:48 ` René Scharfe [this message]
2017-06-15 21:56 ` Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f7d38553-484b-ee81-e059-2c737dad2bc4@web.de \
--to=l.s.r@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
--cc=peff@peff.net \
/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.
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 NNTP newsgroup(s).