public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: John Keeping <john@keeping•me.uk>
Cc: Duy Nguyen <pclouds@gmail•com>, Johannes Sixt <j6t@kdbg•org>,
	Git Mailing List <git@vger•kernel.org>,
	Jens Lehmann <Jens.Lehmann@web•de>
Subject: Re: [PATCH 1/2] reset: handle submodule with trailing slash
Date: Wed, 11 Sep 2013 11:14:57 -0700	[thread overview]
Message-ID: <xmqq8uz3tece.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20130911172705.GV2582@serenity.lan> (John Keeping's message of "Wed, 11 Sep 2013 18:27:05 +0100")

John Keeping <john@keeping•me.uk> writes:

> On Wed, Sep 11, 2013 at 10:08:18AM -0700, Junio C Hamano wrote:
>> Duy Nguyen <pclouds@gmail•com> 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"?
>
> Duy's suggestion below is necessary to avoid this then I think - we'll
> die if the user has a corrupt index and gives a path with a trailing
> slash, but without that path we won't try to load the index.

Sorry, but I don't quite follow.  Isn't "git reset --soft <path>" a
nonsense, with or without a trailing slash at the end of <path>?


>> > 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.

  reply	other threads:[~2013-09-11 18:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-10 19:13 [PATCH 0/2] reset: handle submodule with trailing slash John Keeping
2013-09-10 19:13 ` [PATCH 1/2] " John Keeping
2013-09-10 19:37   ` Jens Lehmann
2013-09-10 19:46     ` John Keeping
2013-09-11  6:05   ` Johannes Sixt
2013-09-11  8:20     ` John Keeping
2013-09-11 10:54       ` Duy Nguyen
2013-09-11 11:08         ` John Keeping
2013-09-11 11:20           ` Duy Nguyen
2013-09-11 17:08         ` Junio C Hamano
2013-09-11 17:27           ` John Keeping
2013-09-11 18:14             ` Junio C Hamano [this message]
2013-09-11 18:22               ` John Keeping
2013-09-11 18:45                 ` Junio C Hamano
2013-09-10 19:13 ` [PATCH 2/2] rm: re-use parse_pathspec's trailing-slash removal John Keeping
2013-09-11  7:48   ` Duy Nguyen
2013-09-11  8:24     ` John Keeping
2013-09-12 19:24 ` [PATCH v2 0/4] submodule trailing slash improvements John Keeping
2013-09-12 19:24   ` [PATCH v2 1/4] pathspec: use is_dir_sep() to check for trailing slashes John Keeping
2013-09-12 20:17     ` Johannes Sixt
2013-09-12 19:24   ` [PATCH v2 2/4] pathspec: strip multiple trailing slashes from submodules John Keeping
2013-09-12 19:48     ` Junio C Hamano
2013-09-12 20:21       ` John Keeping
2013-09-13  1:28         ` Duy Nguyen
2013-09-13  8:48           ` John Keeping
2013-09-12 19:25   ` [PATCH v2 3/4] rm: re-use parse_pathspec's trailing-slash removal John Keeping
2013-09-12 19:25   ` [PATCH v2 4/4] reset: handle submodule with trailing slash John Keeping

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=xmqq8uz3tece.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=Jens.Lehmann@web$(echo .)de \
    --cc=git@vger$(echo .)kernel.org \
    --cc=j6t@kdbg$(echo .)org \
    --cc=john@keeping$(echo .)me.uk \
    --cc=pclouds@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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