From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Rast Subject: Re: [PATCH 1/4] commit: reload cache properly Date: Thu, 30 May 2013 14:17:14 +0200 Message-ID: <87ehcok6gl.fsf@linux-k42r.v.cablecom.net> References: <1369915136-4248-1-git-send-email-felipe.contreras@gmail.com> <1369915136-4248-2-git-send-email-felipe.contreras@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , Junio C Hamano , =?utf-8?Q?R?= =?utf-8?Q?en=C3=A9?= Scharfe , =?utf-8?B?Tmd1eeG7hW4gVGjDoWkgTmfhu41j?= Duy , "Adam Spiers" , Ramkumar Ramachandra , Stephen Boyd To: Felipe Contreras X-From: git-owner@vger.kernel.org Thu May 30 14:17:23 2013 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ui1nG-0005Aa-1x for gcvg-git-2@plane.gmane.org; Thu, 30 May 2013 14:17:22 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752939Ab3E3MRS (ORCPT ); Thu, 30 May 2013 08:17:18 -0400 Received: from edge20.ethz.ch ([82.130.99.26]:37284 "EHLO edge20.ethz.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751093Ab3E3MRR (ORCPT ); Thu, 30 May 2013 08:17:17 -0400 Received: from CAS20.d.ethz.ch (172.31.51.110) by edge20.ethz.ch (82.130.99.26) with Microsoft SMTP Server (TLS) id 14.2.298.4; Thu, 30 May 2013 14:17:14 +0200 Received: from linux-k42r.v.cablecom.net.ethz.ch (129.132.153.233) by CAS20.d.ethz.ch (172.31.51.110) with Microsoft SMTP Server (TLS) id 14.2.298.4; Thu, 30 May 2013 14:17:14 +0200 In-Reply-To: <1369915136-4248-2-git-send-email-felipe.contreras@gmail.com> (Felipe Contreras's message of "Thu, 30 May 2013 06:58:53 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-Originating-IP: [129.132.153.233] Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Felipe Contreras 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. -- Thomas Rast trast@{inf,student}.ethz.ch