[PATCHv3 5/6] refs.c: remove unlock_ref and commit_ref from write_ref_sha1

2015-01-23 Thread Stefan Beller
This makes write_ref_sha1 only write the the lock file, committing needs to be done outside of that function. This will help us change the ref_transaction_commit in a later patch. Also instead of calling unlock_ref before each return in write_ref_sha1 we can call this after the call. This is a

Re: [PATCHv3 5/6] refs.c: remove unlock_ref and commit_ref from write_ref_sha1

2015-01-23 Thread Stefan Beller
On Fri, Jan 23, 2015 at 4:39 PM, Junio C Hamano gits...@pobox.com wrote: Stefan Beller sbel...@google.com writes: On Fri, Jan 23, 2015 at 3:57 PM, Junio C Hamano gits...@pobox.com wrote: Stefan Beller sbel...@google.com writes: -static int commit_ref(struct ref_lock *lock) +static int

Re: [PATCHv3 5/6] refs.c: remove unlock_ref and commit_ref from write_ref_sha1

2015-01-23 Thread Junio C Hamano
Stefan Beller sbel...@google.com writes: -static int commit_ref(struct ref_lock *lock) +static int commit_ref(struct ref_lock *lock, const unsigned char *sha1) { + if (!lock-force_write !hashcmp(lock-old_sha1, sha1)) + return 0; if (commit_lock_file(lock-lk))

Re: [PATCHv3 5/6] refs.c: remove unlock_ref and commit_ref from write_ref_sha1

2015-01-23 Thread Stefan Beller
On Fri, Jan 23, 2015 at 3:57 PM, Junio C Hamano gits...@pobox.com wrote: Stefan Beller sbel...@google.com writes: -static int commit_ref(struct ref_lock *lock) +static int commit_ref(struct ref_lock *lock, const unsigned char *sha1) { + if (!lock-force_write !hashcmp(lock-old_sha1,

Re: [PATCHv3 5/6] refs.c: remove unlock_ref and commit_ref from write_ref_sha1

2015-01-23 Thread Junio C Hamano
Stefan Beller sbel...@google.com writes: On Fri, Jan 23, 2015 at 3:57 PM, Junio C Hamano gits...@pobox.com wrote: Stefan Beller sbel...@google.com writes: -static int commit_ref(struct ref_lock *lock) +static int commit_ref(struct ref_lock *lock, const unsigned char *sha1) { + if

Re: [PATCHv3 5/6] refs.c: remove unlock_ref and commit_ref from write_ref_sha1

2015-01-23 Thread Junio C Hamano
Stefan Beller sbel...@google.com writes: On Fri, Jan 23, 2015 at 4:39 PM, Junio C Hamano gits...@pobox.com wrote: Stefan Beller sbel...@google.com writes: On Fri, Jan 23, 2015 at 3:57 PM, Junio C Hamano gits...@pobox.com wrote: Stefan Beller sbel...@google.com writes: -static int