log_ref_write(): inline function
This function doesn't do anything beyond call files_log_ref_write(), so replace it with the latter at its call sites. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
990c98d2bd
commit
81b1b6d4ff
@ -2832,14 +2832,6 @@ static int log_ref_write_1(const char *refname, const unsigned char *old_sha1,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int log_ref_write(const char *refname, const unsigned char *old_sha1,
|
|
||||||
const unsigned char *new_sha1, const char *msg,
|
|
||||||
int flags, struct strbuf *err)
|
|
||||||
{
|
|
||||||
return files_log_ref_write(refname, old_sha1, new_sha1, msg, flags,
|
|
||||||
err);
|
|
||||||
}
|
|
||||||
|
|
||||||
int files_log_ref_write(const char *refname, const unsigned char *old_sha1,
|
int files_log_ref_write(const char *refname, const unsigned char *old_sha1,
|
||||||
const unsigned char *new_sha1, const char *msg,
|
const unsigned char *new_sha1, const char *msg,
|
||||||
int flags, struct strbuf *err)
|
int flags, struct strbuf *err)
|
||||||
@ -2903,7 +2895,8 @@ static int commit_ref_update(struct files_ref_store *refs,
|
|||||||
assert_main_repository(&refs->base, "commit_ref_update");
|
assert_main_repository(&refs->base, "commit_ref_update");
|
||||||
|
|
||||||
clear_loose_ref_cache(refs);
|
clear_loose_ref_cache(refs);
|
||||||
if (log_ref_write(lock->ref_name, lock->old_oid.hash, sha1, logmsg, 0, err)) {
|
if (files_log_ref_write(lock->ref_name, lock->old_oid.hash, sha1,
|
||||||
|
logmsg, 0, err)) {
|
||||||
char *old_msg = strbuf_detach(err, NULL);
|
char *old_msg = strbuf_detach(err, NULL);
|
||||||
strbuf_addf(err, "cannot update the ref '%s': %s",
|
strbuf_addf(err, "cannot update the ref '%s': %s",
|
||||||
lock->ref_name, old_msg);
|
lock->ref_name, old_msg);
|
||||||
@ -2934,7 +2927,7 @@ static int commit_ref_update(struct files_ref_store *refs,
|
|||||||
if (head_ref && (head_flag & REF_ISSYMREF) &&
|
if (head_ref && (head_flag & REF_ISSYMREF) &&
|
||||||
!strcmp(head_ref, lock->ref_name)) {
|
!strcmp(head_ref, lock->ref_name)) {
|
||||||
struct strbuf log_err = STRBUF_INIT;
|
struct strbuf log_err = STRBUF_INIT;
|
||||||
if (log_ref_write("HEAD", lock->old_oid.hash, sha1,
|
if (files_log_ref_write("HEAD", lock->old_oid.hash, sha1,
|
||||||
logmsg, 0, &log_err)) {
|
logmsg, 0, &log_err)) {
|
||||||
error("%s", log_err.buf);
|
error("%s", log_err.buf);
|
||||||
strbuf_release(&log_err);
|
strbuf_release(&log_err);
|
||||||
@ -2973,7 +2966,8 @@ static void update_symref_reflog(struct ref_lock *lock, const char *refname,
|
|||||||
struct strbuf err = STRBUF_INIT;
|
struct strbuf err = STRBUF_INIT;
|
||||||
unsigned char new_sha1[20];
|
unsigned char new_sha1[20];
|
||||||
if (logmsg && !read_ref(target, new_sha1) &&
|
if (logmsg && !read_ref(target, new_sha1) &&
|
||||||
log_ref_write(refname, lock->old_oid.hash, new_sha1, logmsg, 0, &err)) {
|
files_log_ref_write(refname, lock->old_oid.hash, new_sha1,
|
||||||
|
logmsg, 0, &err)) {
|
||||||
error("%s", err.buf);
|
error("%s", err.buf);
|
||||||
strbuf_release(&err);
|
strbuf_release(&err);
|
||||||
}
|
}
|
||||||
@ -3748,9 +3742,11 @@ static int files_transaction_commit(struct ref_store *ref_store,
|
|||||||
|
|
||||||
if (update->flags & REF_NEEDS_COMMIT ||
|
if (update->flags & REF_NEEDS_COMMIT ||
|
||||||
update->flags & REF_LOG_ONLY) {
|
update->flags & REF_LOG_ONLY) {
|
||||||
if (log_ref_write(lock->ref_name, lock->old_oid.hash,
|
if (files_log_ref_write(lock->ref_name,
|
||||||
|
lock->old_oid.hash,
|
||||||
update->new_sha1,
|
update->new_sha1,
|
||||||
update->msg, update->flags, err)) {
|
update->msg, update->flags,
|
||||||
|
err)) {
|
||||||
char *old_msg = strbuf_detach(err, NULL);
|
char *old_msg = strbuf_detach(err, NULL);
|
||||||
|
|
||||||
strbuf_addf(err, "cannot update the ref '%s': %s",
|
strbuf_addf(err, "cannot update the ref '%s': %s",
|
||||||
|
Reference in New Issue
Block a user