summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2015-05-09 15:29:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-05-13 04:28:03 (GMT)
commit61e51e0000073b684eaf5393ae2229f4f62f35c9 (patch)
tree3b52b2b1c29a3cb3cc33ecc54d99274b749b335e /refs.c
parentba43b7f29c59f75cf5f28af3a02d16c08937e439 (diff)
downloadgit-61e51e0000073b684eaf5393ae2229f4f62f35c9.zip
git-61e51e0000073b684eaf5393ae2229f4f62f35c9.tar.gz
git-61e51e0000073b684eaf5393ae2229f4f62f35c9.tar.bz2
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>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/refs.c b/refs.c
index ad4b6d5..6cb1476 100644
--- a/refs.c
+++ b/refs.c
@@ -3108,21 +3108,6 @@ static int commit_ref_update(struct ref_lock *lock,
return 0;
}
-/*
- * Write sha1 as the new value of the reference specified by the
- * (open) lock. On error, roll back the lockfile and set errno
- * appropriately.
- */
-static int write_ref_sha1(struct ref_lock *lock,
- const unsigned char *sha1, const char *logmsg)
-{
- if (write_ref_to_lockfile(lock, sha1) ||
- commit_ref_update(lock, sha1, logmsg))
- return -1;
-
- return 0;
-}
-
int create_symref(const char *ref_target, const char *refs_heads_master,
const char *logmsg)
{
@@ -3816,9 +3801,13 @@ int ref_transaction_commit(struct ref_transaction *transaction,
*/
unlock_ref(update->lock);
update->lock = NULL;
- } else if (write_ref_sha1(update->lock, update->new_sha1,
- update->msg)) {
- update->lock = NULL; /* freed by write_ref_sha1 */
+ } else if (write_ref_to_lockfile(update->lock,
+ update->new_sha1) ||
+ commit_ref_update(update->lock,
+ update->new_sha1,
+ update->msg)) {
+ /* freed by one of the above calls: */
+ update->lock = NULL;
strbuf_addf(err, "Cannot update the ref '%s'.",
update->refname);
ret = TRANSACTION_GENERIC_ERROR;