log_ref_write_1(): don't depend on logfile argument
It's unnecessary to pass a strbuf holding the reflog path up and down the call stack now that it is hardly needed by the callers. Remove the places where log_ref_write_1() uses it, in preparation for making it internal to log_ref_setup(). 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>
Michael Haggerty committed
Jan 6, 2017 at 17:22 UTC
87b21e05ed869806f865ada8f5d977ce99f18f20
1 file changed
+8
-4
refs/files-backend.c
+8
-4
@@ -2838,14 +2838,18 @@ static int log_ref_write_1(const char *refname, const unsigned char *old_sha1,
2838
result = log_ref_write_fd(logfd, old_sha1, new_sha1,
2839
git_committer_info(0), msg);
2840
if (result) {
2841
- strbuf_addf(err, "unable to append to '%s': %s", logfile->buf,
2842
- strerror(errno));
2841
+ int save_errno = errno;
2842
+
2843
+ strbuf_addf(err, "unable to append to '%s': %s",
2844
+ git_path("logs/%s", refname), strerror(save_errno));
2845
close(logfd);
2846
return -1;
2847
}
2848
if (close(logfd)) {
2847
- strbuf_addf(err, "unable to append to '%s': %s", logfile->buf,
2848
- strerror(errno));
2849
+ int save_errno = errno;
2850
+
2851
+ strbuf_addf(err, "unable to append to '%s': %s",
2852
+ git_path("logs/%s", refname), strerror(save_errno));
2853
return -1;
2854
}
2855
return 0;