refs.c: remove the update_ref_lock function

Since we now only call update_ref_lock with onerr==QUIET_ON_ERR we no longer need this function and can replace it with just calling lock_any_ref_for_update directly. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ronnie Sahlberg committed Apr 29, 2014 at 12:14 UTC 45421e24e8322184a35a32a9072f04afabe33880
1 file changed +6 -24
refs.c
+6 -24
@@ -3336,24 +3336,6 @@ int for_each_reflog(each_ref_fn fn, void *cb_data)
3336 return retval;
3337 }
3338
3339 -static struct ref_lock *update_ref_lock(const char *refname,
3340 - const unsigned char *oldval,
3341 - int flags, int *type_p,
3342 - enum action_on_err onerr)
3343 -{
3344 - struct ref_lock *lock;
3345 - lock = lock_any_ref_for_update(refname, oldval, flags, type_p);
3346 - if (!lock) {
3347 - const char *str = "Cannot lock the ref '%s'.";
3348 - switch (onerr) {
3349 - case UPDATE_REFS_MSG_ON_ERR: error(str, refname); break;
3350 - case UPDATE_REFS_DIE_ON_ERR: die(str, refname); break;
3351 - case UPDATE_REFS_QUIET_ON_ERR: break;
3352 - }
3353 - }
3354 - return lock;
3355 -}
3356 -
3339 static int update_ref_write(const char *action, const char *refname,
3340 const unsigned char *sha1, struct ref_lock *lock,
3341 struct strbuf *err, enum action_on_err onerr)
@@ -3603,12 +3585,12 @@ int ref_transaction_commit(struct ref_transaction *transaction,
3585 for (i = 0; i < n; i++) {
3586 struct ref_update *update = updates[i];
3587
3606 - update->lock = update_ref_lock(update->refname,
3607 - (update->have_old ?
3608 - update->old_sha1 : NULL),
3609 - update->flags,
3610 - &update->type,
3611 - UPDATE_REFS_QUIET_ON_ERR);
3588 + update->lock = lock_any_ref_for_update(update->refname,
3589 + (update->have_old ?
3590 + update->old_sha1 :
3591 + NULL),
3592 + update->flags,
3593 + &update->type);
3594 if (!update->lock) {
3595 if (err)
3596 strbuf_addf(err, "Cannot lock the ref '%s'.",