Skip to content

Commit 61e51e0

Browse files
mhaggergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ba43b7f commit 61e51e0

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

refs.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3108,21 +3108,6 @@ static int commit_ref_update(struct ref_lock *lock,
31083108
return 0;
31093109
}
31103110

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-
31263111
int create_symref(const char *ref_target, const char *refs_heads_master,
31273112
const char *logmsg)
31283113
{
@@ -3816,9 +3801,13 @@ int ref_transaction_commit(struct ref_transaction *transaction,
38163801
*/
38173802
unlock_ref(update->lock);
38183803
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;
38223811
strbuf_addf(err, "Cannot update the ref '%s'.",
38233812
update->refname);
38243813
ret = TRANSACTION_GENERIC_ERROR;

0 commit comments

Comments
 (0)