git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
	Paul Tan <pyokagan@gmail.com>
Subject: Re: [PATCH 1/3] wt-status: implement opportunisitc index update correctly
Date: Wed, 7 Dec 2016 14:06:08 -0800	[thread overview]
Message-ID: <CAGZ79ka_Sh7jppCVkAhFWkXNffEg_SxUGN9VULseJBpQkDSyww@mail.gmail.com> (raw)
In-Reply-To: <xmqqmvg7wips.fsf@gitster.mtv.corp.google.com>

On Wed, Dec 7, 2016 at 1:08 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Stefan Beller <sbeller@google.com> writes:
>
>> So my first question I had to answer was if we do the right thing here,
>> i.e. if we could just fail instead. But we want to continue and just
>> not write back the index, which is fine.
>>
>> So we do not have to guard refresh_cache, but just call
>> update_index_if_able conditionally.
>
> An explanation with stepping back a little bit may help.
>
> You may be asked to visit a repository of a friend, to which you do
> not have write access to but you can still read.  You may want to do
> "diff", "status" or "describe" there.
>
> In order to avoid getting fooled into thinking some paths are dirty
> only because the cached stat information does not match, these need
> to refresh the in-core index before doing their "comparison" to
> report which paths are different (in "diff"), what are the modified
> but not staged paths (in "status"), and if there is a need to add
> the "-dirty" suffix (in "describe").
>
> Since we are doing the expensive "bunch of lstat()" anyway, if we
> could write it back to the index, it would help future operations in
> the same repository--that is the reasoning behind the opportunistic
> updates.  It is perfectly OK if we do not have write access to the
> repository and cannot write update the index.
>

Thanks for that explanation!
So I agree that we should not call it _if_needed, but the _if_able
part is still confusing, as we check for different parts here.

The case of not being able to write (read only) sounds similar to
the case of not being able to write (a concurrent lock),
I'll think about it more.

Thanks,
Stefan

  reply	other threads:[~2016-12-07 22:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-03  1:44 [BUG] Index.lock error message regression in git 2.11.0 Robbie Iannucci
2016-12-03  1:52 ` Robbie Iannucci
2016-12-06 21:56 ` Junio C Hamano
2016-12-06 22:15   ` Re* " Junio C Hamano
2016-12-07 18:21     ` Junio C Hamano
2016-12-07 19:41       ` [PATCH 0/3] Do not be totally silent upon lock error Junio C Hamano
2016-12-07 19:41         ` [PATCH 1/3] wt-status: implement opportunisitc index update correctly Junio C Hamano
2016-12-07 20:48           ` Stefan Beller
2016-12-07 20:53             ` Junio C Hamano
2016-12-07 20:56               ` Stefan Beller
2016-12-07 21:08             ` Junio C Hamano
2016-12-07 22:06               ` Stefan Beller [this message]
2016-12-08 10:18             ` Paul Tan
2016-12-08 18:01               ` Junio C Hamano
2016-12-07 19:41         ` [PATCH 2/3] hold_locked_index(): align error handling with hold_lockfile_for_update() Junio C Hamano
2016-12-07 19:41         ` [PATCH 3/3] lockfile: LOCK_REPORT_ON_ERROR Junio C Hamano
2016-12-08 11:53           ` Johannes Schindelin
2016-12-08 18:10             ` Robbie Iannucci
2016-12-08 18:22             ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGZ79ka_Sh7jppCVkAhFWkXNffEg_SxUGN9VULseJBpQkDSyww@mail.gmail.com \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pyokagan@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).