Re: [PATCH 49/83] builtin/apply: move 'lock_file' global into 'struct apply_state'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 28, 2016, 20:17 UTC
- Message-ID
- <xmqq1t5p4he4.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <CAP8UFD1=w2D-5q9bWrYqzL3v1q7fYi9imy1UhG2OaW2vB=2ECA@mail.gmail.com>
Christian Couder <christian.couder@gmail.com> writes:
Show 6 quoted lines
>> I do not think you need to think about "free"ing. > > Yeah, lockfile.h says: > ... > and: > ...
Yup, we are now on the same page.
Show 5 quoted lines
>> Even if the libified version of the apply internal can be called >> multiple times to process multiple patch inputs, there is no need to >> run multiple instances of it yet. And a lockfile, after the caller >> finishes interacting with one file using it by calling commit or >> rollback, can be reused to interact with another file.
lockfile.h says this about the above paragraph, which is a more important part ;-)
* When finished writing, the caller can: * ... * Even after the lockfile is committed or rolled back, the * `lock_file` object must not be freed or altered by the caller. * However, it may be reused; just pass it to another call of * `hold_lock_file_for_update()`.