Re: [PATCH v1 2/2] entry.c: check if file exists after checkout

2017-10-08 Thread Lars Schneider
> On 06 Oct 2017, at 06:56, Jeff King wrote: > > On Fri, Oct 06, 2017 at 01:26:48PM +0900, Junio C Hamano wrote: > > ... >> -- >8 -- >> From: Lars Schneider >> Date: Thu, 5 Oct 2017 12:44:07 +0200 >> Subject: [PATCH] entry.c: check if file exists after

Re: [PATCH v1 2/2] entry.c: check if file exists after checkout

2017-10-06 Thread Junio C Hamano
On Fri, Oct 6, 2017 at 3:05 PM, Jeff King wrote: > >> Because we cannot quite tell between the two cases (one is error--we >> wrote or we thought we wrote, but we cannot find it, the other is >> dubious--somebody was racing with us in the filesystem), I think it >> is reasonable to

Re: [PATCH v1 2/2] entry.c: check if file exists after checkout

2017-10-06 Thread Jeff King
On Fri, Oct 06, 2017 at 03:03:49PM +0900, Junio C Hamano wrote: > Jeff King writes: > > > I don't know if we wanted to capture any of the reasoning behind using > > error() here or not. Frankly, I'm not sure how to argue for it > > succinctly. :) I'm happy with letting it live on

Re: [PATCH v1 2/2] entry.c: check if file exists after checkout

2017-10-06 Thread Junio C Hamano
Jeff King writes: > I don't know if we wanted to capture any of the reasoning behind using > error() here or not. Frankly, I'm not sure how to argue for it > succinctly. :) I'm happy with letting it live on in the list archive. Are you talking about the "philosophical" thing?

Re: [PATCH v1 2/2] entry.c: check if file exists after checkout

2017-10-05 Thread Jeff King
On Fri, Oct 06, 2017 at 01:26:48PM +0900, Junio C Hamano wrote: > > We could probably be a bit more specific about the situation, since the > > user will see this message with no context. Maybe something like: > > > > unable to stat just-written file %s > > > > or something. We should probably

Re: [PATCH v1 2/2] entry.c: check if file exists after checkout

2017-10-05 Thread Junio C Hamano
Jeff King writes: >> diff --git a/entry.c b/entry.c >> index 5dab656364..2252d96756 100644 >> --- a/entry.c >> +++ b/entry.c >> @@ -355,7 +355,8 @@ static int write_entry(struct cache_entry *ce, >> if (state->refresh_cache) { >> assert(state->istate); >>

Re: [PATCH v1 2/2] entry.c: check if file exists after checkout

2017-10-05 Thread Jeff King
On Thu, Oct 05, 2017 at 12:44:07PM +0200, lars.schnei...@autodesk.com wrote: > From: Lars Schneider > > If we are checking out a file and somebody else racily deletes our file, > then we would write garbage to the cache entry. Fix that by checking > the result of the

[PATCH v1 2/2] entry.c: check if file exists after checkout

2017-10-05 Thread lars . schneider
From: Lars Schneider If we are checking out a file and somebody else racily deletes our file, then we would write garbage to the cache entry. Fix that by checking the result of the lstat() call on that file. Print an error to the user if the file does not exist.