write_ref_sha1(): move write elision test to callers
commit706d5f816fbcb1299c19f4d41bea60f1e229165e
authorMichael Haggerty <mhagger@alum.mit.edu>
Mon, 2 Mar 2015 09:29:52 +0000 (2 10:29 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Mar 2015 20:35:36 +0000 (5 12:35 -0800)
tree3d2a8d3b4e750d984af6bf88be391bed49ca0182
parent8280bbebd1ecc4633b969a439ed4ca653d1bc958
write_ref_sha1(): move write elision test to callers

write_ref_sha1() previously skipped the write if the reference already
had the desired value, unless lock->force_write was set. Instead,
perform that test at the callers.

Two of the callers (in rename_ref()) unconditionally set force_write
just before calling write_ref_sha1(), so they don't need the extra
check at all. Nor do they need to set force_write anymore.

The last caller, in ref_transaction_commit(), still needs the test.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c