git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Paul Tan <pyokagan@gmail.com>
Cc: Stefan Beller <sbeller@google.com>,
	"git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH 1/3] wt-status: implement opportunisitc index update correctly
Date: Thu, 08 Dec 2016 10:01:54 -0800	[thread overview]
Message-ID: <xmqqmvg6ti3x.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CACRoPnRpZr=E6SW81Vg-2TiOr=RJo1YouAt5iZoE0CNBx-qesg@mail.gmail.com> (Paul Tan's message of "Thu, 8 Dec 2016 18:18:39 +0800")

Paul Tan <pyokagan@gmail.com> writes:

> Hmm, to add on, looking at the three other call sites of this
> function, two of them (builtin/commit.c and builtin/describe.c)
> basically do:
>
>     if (0 <= fd)
>         update_index_if_able(...)
>
> with that 0 <= fd conditional. With this patch it becomes three out of
> four.

The other one is diff.c::refresh_index_quietly() that you are not
counting, I think, but if you look at it again, it also is not
called after hold_locked_index() fails to acquire the lock, so with
this fix everybody refrains from calling it when it does not hold
the lock.

> Perhaps the repeated use of this conditional is a sign that the
> 0 <= fd check could be built into update_index_if_able()?

That condition is "do we have the lock?  Otherwise we are not even
allowed to update it", so in that sense it may make sense.

> I think there is precedent for building in these kind of checks --
> rollback_lock_file() also does not fail if the lock file was not
> successfully opened.
>
> That said, the number of call sites is quite low so it's probably not
> worth doing this.

Yeah, I can go either way.  At least with the change things are
consistent.

  reply	other threads:[~2016-12-08 18:02 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
2016-12-08 10:18             ` Paul Tan
2016-12-08 18:01               ` Junio C Hamano [this message]
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=xmqqmvg6ti3x.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=pyokagan@gmail.com \
    --cc=sbeller@google.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).