Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-09 Thread Jeff King
On Tue, Dec 09, 2014 at 10:47:24AM -0800, Junio C Hamano wrote: > Michael Haggerty writes: > > > This isn't documented very well. I thought I saw a comment somewhere in > > the code that stated it explicitly, but I can't find it now. In any > > case, my understanding of the locking protocol for

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-09 Thread Junio C Hamano
Michael Haggerty writes: > This isn't documented very well. I thought I saw a comment somewhere in > the code that stated it explicitly, but I can't find it now. In any > case, my understanding of the locking protocol for reflogs is: > > The reflog for "$refname", which is stored at > "$G

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-08 Thread Michael Haggerty
On 12/05/2014 01:23 AM, Jonathan Nieder wrote: > Michael Haggerty wrote: > >> We don't actually need the locking functionality, because we already >> hold the lock on the reference itself, which is how the reflog file is >> locked. But the lock_file code still does some of the bookkeeping for >> u

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-08 Thread Michael Haggerty
On 12/05/2014 03:59 AM, ronnie sahlberg wrote: > On Thu, Dec 4, 2014 at 3:08 PM, Michael Haggerty wrote: >> We don't actually need the locking functionality, because we already >> hold the lock on the reference itself, > > No. You do need the lock. > The ref is locked only during transaction_comm

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-08 Thread Michael Haggerty
On 12/05/2014 03:19 AM, Stefan Beller wrote: > On Thu, Dec 04, 2014 at 04:23:31PM -0800, Jonathan Nieder wrote: >> Michael Haggerty wrote: >> >>> We don't actually need the locking functionality, because we already >>> hold the lock on the reference itself, which is how the reflog file is >>> locke

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-05 Thread Junio C Hamano
Stefan Beller writes: >>> After the series completes, this lock is only used in reflog_expire. >>> So I'd rather move it inside the function? Then we could run the >>> reflog_expire >>> function in parallel for different locks in theory? >> >> I am not sure about the "parallel" part, but I would

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-05 Thread Stefan Beller
On Fri, Dec 5, 2014 at 11:32 AM, Junio C Hamano wrote: > Stefan Beller writes: > >>> > +static struct lock_file reflog_lock; >>> >>> If this lockfile is only used in that one function, it can be declared >>> inside the function. >>> >>> If it is meant to be used throughout the 'git reflog' comman

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-05 Thread Junio C Hamano
Stefan Beller writes: >> > +static struct lock_file reflog_lock; >> >> If this lockfile is only used in that one function, it can be declared >> inside the function. >> >> If it is meant to be used throughout the 'git reflog' command, then it >> can go near the top of the file. >> > > After th

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-05 Thread Stefan Beller
On Thu, Dec 04, 2014 at 04:23:31PM -0800, Jonathan Nieder wrote: > Michael Haggerty wrote: > > > We don't actually need the locking functionality, because we already > > hold the lock on the reference itself, which is how the reflog file is > > locked. But the lock_file code still does some of the

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-05 Thread Stefan Beller
On Thu, Dec 04, 2014 at 06:51:36PM -0800, ronnie sahlberg wrote: > On Thu, Dec 4, 2014 at 3:08 PM, Michael Haggerty > wrote: > > > We don't actually need the locking functionality, because we already > > hold the lock on the reference itself, > > > No. You do need the lock. > The ref is locked

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-04 Thread ronnie sahlberg
On Thu, Dec 4, 2014 at 3:08 PM, Michael Haggerty wrote: > We don't actually need the locking functionality, because we already > hold the lock on the reference itself, No. You do need the lock. The ref is locked only during transaction_commit() If you don't want to lock the reflog file and inste

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-04 Thread Stefan Beller
On Thu, Dec 04, 2014 at 04:23:31PM -0800, Jonathan Nieder wrote: > Michael Haggerty wrote: > > > We don't actually need the locking functionality, because we already > > hold the lock on the reference itself, which is how the reflog file is > > locked. But the lock_file code still does some of the

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-04 Thread Jonathan Nieder
Michael Haggerty wrote: > We don't actually need the locking functionality, because we already > hold the lock on the reference itself, which is how the reflog file is > locked. But the lock_file code still does some of the bookkeeping for > us and is more careful than the old code here was. As y

[PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2014-12-04 Thread Michael Haggerty
We don't actually need the locking functionality, because we already hold the lock on the reference itself, which is how the reflog file is locked. But the lock_file code still does some of the bookkeeping for us and is more careful than the old code here was. For example: * Correctly handle the