Re: [PATCH 1/3] wt-status: implement opportunisitc index update correctly

2016-12-08 Thread Junio C Hamano
Paul Tan 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

Re: [PATCH 1/3] wt-status: implement opportunisitc index update correctly

2016-12-08 Thread Paul Tan
Hi Junio, On Thu, Dec 8, 2016 at 4:48 AM, Stefan Beller wrote: > On Wed, Dec 7, 2016 at 11:41 AM, Junio C Hamano wrote: >> The require_clean_work_tree() function calls hold_locked_index() >> with die_on_error=0 to signal that it is OK if it fails to obtain

Re: [PATCH 1/3] wt-status: implement opportunisitc index update correctly

2016-12-07 Thread Stefan Beller
On Wed, Dec 7, 2016 at 1:08 PM, Junio C Hamano wrote: > Stefan Beller 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,

Re: [PATCH 1/3] wt-status: implement opportunisitc index update correctly

2016-12-07 Thread Junio C Hamano
Stefan Beller 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 >

Re: [PATCH 1/3] wt-status: implement opportunisitc index update correctly

2016-12-07 Thread Stefan Beller
On Wed, Dec 7, 2016 at 11:41 AM, Junio C Hamano wrote: > The require_clean_work_tree() function calls hold_locked_index() > with die_on_error=0 to signal that it is OK if it fails to obtain > the lock, but unconditionally calls update_index_if_able(), which > will try to write

Re: [PATCH 1/3] wt-status: implement opportunisitc index update correctly

2016-12-07 Thread Stefan Beller
On Wed, Dec 7, 2016 at 12:53 PM, Junio C Hamano wrote: > On Wed, Dec 7, 2016 at 12:48 PM, Stefan Beller wrote: >> >> So I would expect that we'd rather fix the update_index_if_able instead by >> checking for the lockfile to be in the correct state? > > I

Re: [PATCH 1/3] wt-status: implement opportunisitc index update correctly

2016-12-07 Thread Junio C Hamano
On Wed, Dec 7, 2016 at 12:48 PM, Stefan Beller wrote: > > So I would expect that we'd rather fix the update_index_if_able instead by > checking for the lockfile to be in the correct state? I actually don't expect that, after looking at other call sites of that function.

[PATCH 1/3] wt-status: implement opportunisitc index update correctly

2016-12-07 Thread Junio C Hamano
The require_clean_work_tree() function calls hold_locked_index() with die_on_error=0 to signal that it is OK if it fails to obtain the lock, but unconditionally calls update_index_if_able(), which will try to write into fd=-1. Signed-off-by: Junio C Hamano --- wt-status.c | 7