Re: [PATCH 22/22] lockfile: allow new file contents to be written while retaining lock

2014-04-02 Thread Eric Sunshine
On Tue, Apr 1, 2014 at 11:58 AM, Michael Haggerty mhag...@alum.mit.edu wrote: Add a new option flag, LOCK_SEPARATE_STAGING_FILE, that can be passed to hold_lock_file_for_update() or hold_lock_file_for_append() to use a staging file that is independent of the lock file. Add a new function

Re: [PATCH 22/22] lockfile: allow new file contents to be written while retaining lock

2014-04-02 Thread Junio C Hamano
Michael Haggerty mhag...@alum.mit.edu writes: +static int open_staging_file(struct lock_file *lk) +{ + strbuf_setlen(lk-staging_filename, lk-filename.len); + strbuf_addstr(lk-staging_filename, .new); + lk-fd = open(lk-staging_filename.buf, O_RDWR | O_CREAT | O_EXCL, 0666); +

Re: [PATCH 22/22] lockfile: allow new file contents to be written while retaining lock

2014-04-01 Thread Jeff King
On Tue, Apr 01, 2014 at 05:58:30PM +0200, Michael Haggerty wrote: Add a new option flag, LOCK_SEPARATE_STAGING_FILE, that can be passed to hold_lock_file_for_update() or hold_lock_file_for_append() to use a staging file that is independent of the lock file. Add a new function