Skip to content

Commit 87b21e0

Browse files
mhaggergitster
authored andcommitted
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 <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e404f45 commit 87b21e0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

refs/files-backend.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2838,14 +2838,18 @@ static int log_ref_write_1(const char *refname, const unsigned char *old_sha1,
28382838
result = log_ref_write_fd(logfd, old_sha1, new_sha1,
28392839
git_committer_info(0), msg);
28402840
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));
28432845
close(logfd);
28442846
return -1;
28452847
}
28462848
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));
28492853
return -1;
28502854
}
28512855
return 0;

0 commit comments

Comments
 (0)