From mboxrd@z Thu Jan 1 00:00:00 1970 From: Junio C Hamano Subject: Re: [PATCH 1/2] reset: handle submodule with trailing slash Date: Wed, 11 Sep 2013 10:08:18 -0700 Message-ID: References: <52300838.5040703@kdbg.org> <20130911082042.GR2582@serenity.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: John Keeping , Johannes Sixt , Git Mailing List , Jens Lehmann To: Duy Nguyen X-From: git-owner@vger.kernel.org Wed Sep 11 19:08:33 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 1VJnu4-0000DR-HF for gcvg-git-2@plane.gmane.org; Wed, 11 Sep 2013 19:08:32 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756446Ab3IKRIW (ORCPT ); Wed, 11 Sep 2013 13:08:22 -0400 Received: from b-pb-sasl-quonix.pobox.com ([208.72.237.35]:48624 "EHLO smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756413Ab3IKRIV (ORCPT ); Wed, 11 Sep 2013 13:08:21 -0400 Received: from smtp.pobox.com (unknown [127.0.0.1]) by b-sasl-quonix.pobox.com (Postfix) with ESMTP id 2D94140AF0; Wed, 11 Sep 2013 17:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=+p3pRgsoUiXm/ByJyHyKJHKhzbA=; b=JXQtSi vYcAc2V8Ev7Rs3u8101AVFsVxi7L/QLcJ9feJBD69frUDGavTIiXSfwTnCNjfHLI lFWs8HRxrqFfdOdKNVwLO2O+hFhKsz8W2sQ58JqMh/U4Vf3hMkNoDXDv7BKTi7Ot A39w+4saR7Qkx2oMNzBuVvA1a2EYJfAv2UGrQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=kfIsgxy2XU+Cgvz95TGe8ovRc2hXC2zZ DowwzoBR4vb07MbQGgZQxKjvOczVKjY41QArzCG3D/3L0mDnv/G3ju64qn49tlID 3sZV6u11aXQvpA7+xJqJy5CgoTNVEDbhswXUnJ7D3P4OdNrl/PpSDBeHNxdYr7JK oamdbzQbWxA= Received: from b-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by b-sasl-quonix.pobox.com (Postfix) with ESMTP id 2053B40AEF; Wed, 11 Sep 2013 17:08:21 +0000 (UTC) Received: from pobox.com (unknown [72.14.226.9]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by b-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 72C6140AEB; Wed, 11 Sep 2013 17:08:20 +0000 (UTC) In-Reply-To: (Duy Nguyen's message of "Wed, 11 Sep 2013 17:54:48 +0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-Pobox-Relay-ID: C24B40DA-1B04-11E3-8C2A-CA9B8506CD1E-77302942!b-pb-sasl-quonix.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Duy Nguyen writes: > reset --soft does not go through these code paths (i.e. it does not > need index at all). If we fail to load index index in "reset --soft" I > think it's ok to die(). Corrupt index is fatal anyway. Do I smell a breakage here? Isn't "reset --soft HEAD" (or some known good commit) a way to recover from a corrupt index? If that is the case, I do not think it is OK at all. What do we suggest as an alternative? "rm .git/index && read-tree"? > But "reset > --soft" now has to pay the cost to load index, which could be slow > when the index is big. Assuming nobody does "reset --soft" that often > I think this is OK. > > Alternatively we could load index lazily in _CHEAP code only when we > see trailing slashes, then replace these read_cache() with > read_cache_unless_its_already_loaded_earlier() or something.