git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Thomas Rast <trast@inf.ethz.ch>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
	"René Scharfe" <rene.scharfe@lsrfire.ath.cx>,
	"Nguyễn Thái Ngọc" <pclouds@gmail.com>,
	"Adam Spiers" <git@adamspiers.org>,
	"Ramkumar Ramachandra" <artagnon@gmail.com>,
	"Stephen Boyd" <sboyd@codeaurora.org>
Subject: Re: [PATCH 1/4] commit: reload cache properly
Date: Thu, 30 May 2013 08:07:57 -0500	[thread overview]
Message-ID: <CAMP44s2_q6-bfxw-3jTQA_aiXynGc7adE_-GebP=D5FY-ou_wg@mail.gmail.com> (raw)
In-Reply-To: <8761y0k4ja.fsf@linux-k42r.v.cablecom.net>

On Thu, May 30, 2013 at 7:58 AM, Thomas Rast <trast@inf.ethz.ch> wrote:
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> On Thu, May 30, 2013 at 7:17 AM, Thomas Rast <trast@inf.ethz.ch> wrote:
>>> Felipe Contreras <felipe.contreras@gmail.com> writes:
>>>
>>>> We are supposedly adding files, to to which cache if 'the_index' is
>>>> discarded?
>>> [...]
>>>>       if (!current_head) {
>>>>               discard_cache();
>>>> +             if (read_cache() < 0)
>>>> +                     die(_("cannot read the index"));
>>>>               return;
>>>>       }
>>>
>>> It is not obvious to me that this is a correct change.  discard_cache()
>>> without subsequent reloading could also legitimately be used to empty
>>> the index.  So if you are fixing a bug, please justify the change and
>>> provide a testcase to guard against it in the future.
>>
>> So istate->initialized is false, yet somebody can still add entries to
>> the cache? What happens when somebody else tries to initialize this
>> cache? All the entries there will be lost, even though nobody
>> discarded it afterwards.
>
> And yet it works, and your patch breaks it.

It might work, but the API doesn't make any sense.

-- 
Felipe Contreras

  reply	other threads:[~2013-05-30 13:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 11:58 [PATCH 0/4] cherry-pick: fix memory leaks Felipe Contreras
2013-05-30 11:58 ` [PATCH 1/4] commit: reload cache properly Felipe Contreras
2013-05-30 12:17   ` Thomas Rast
2013-05-30 12:35     ` Felipe Contreras
2013-05-30 12:58       ` Thomas Rast
2013-05-30 13:07         ` Felipe Contreras [this message]
2013-06-01  9:09         ` Duy Nguyen
2013-06-01 11:02           ` [PATCH] Test 'commit --only' after 'checkout --orphan' Thomas Rast
2013-05-30 13:08     ` [PATCH 1/4] commit: reload cache properly Duy Nguyen
2013-05-30 11:58 ` [PATCH 2/4] read-cache: plug small memory leak Felipe Contreras
2013-05-30 11:58 ` [PATCH 3/4] unpack-trees: plug a " Felipe Contreras
2013-06-02 19:33   ` Junio C Hamano
2013-06-02 19:51     ` Felipe Contreras
2013-06-02 22:17       ` Junio C Hamano
2013-06-02 22:45         ` Felipe Contreras
2013-05-30 11:58 ` [PATCH 4/4] unpack-trees: free created cache entries Felipe Contreras

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='CAMP44s2_q6-bfxw-3jTQA_aiXynGc7adE_-GebP=D5FY-ou_wg@mail.gmail.com' \
    --to=felipe.contreras@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=git@adamspiers.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=rene.scharfe@lsrfire.ath.cx \
    --cc=sboyd@codeaurora.org \
    --cc=trast@inf.ethz.ch \
    /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).