ref_transaction_commit(): inline call to write_ref_sha1()
That was the last caller, so delete function write_ref_sha1(). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
May 9, 2015 at 17:29 UTC
61e51e0000073b684eaf5393ae2229f4f62f35c9
1 file changed
+7
-18
refs.c
+7
-18
@@ -3108,21 +3108,6 @@ static int commit_ref_update(struct ref_lock *lock,
3108
return 0;
3109
}
3110
3111
-/*
3112
- * Write sha1 as the new value of the reference specified by the
3113
- * (open) lock. On error, roll back the lockfile and set errno
3114
- * appropriately.
3115
- */
3116
-static int write_ref_sha1(struct ref_lock *lock,
3117
- const unsigned char *sha1, const char *logmsg)
3118
-{
3119
- if (write_ref_to_lockfile(lock, sha1) ||
3120
- commit_ref_update(lock, sha1, logmsg))
3121
- return -1;
3122
-
3123
- return 0;
3124
-}
3125
-
3111
int create_symref(const char *ref_target, const char *refs_heads_master,
3112
const char *logmsg)
3113
{
@@ -3816,9 +3801,13 @@ int ref_transaction_commit(struct ref_transaction *transaction,
3801
*/
3802
unlock_ref(update->lock);
3803
update->lock = NULL;
3819
- } else if (write_ref_sha1(update->lock, update->new_sha1,
3820
- update->msg)) {
3821
- update->lock = NULL; /* freed by write_ref_sha1 */
3804
+ } else if (write_ref_to_lockfile(update->lock,
3805
+ update->new_sha1) ||
3806
+ commit_ref_update(update->lock,
3807
+ update->new_sha1,
3808
+ update->msg)) {
3809
+ /* freed by one of the above calls: */
3810
+ update->lock = NULL;
3811
strbuf_addf(err, "Cannot update the ref '%s'.",
3812
update->refname);
3813
ret = TRANSACTION_GENERIC_ERROR;