path: root/builtin/reflog.c
diff options
authorMichael Haggerty <>2014-10-01 10:28:32 (GMT)
committerJunio C Hamano <>2014-10-01 20:50:01 (GMT)
commitcf6950d3bfe1447ac04867b1f5654a2fc9c5db96 (patch)
tree2c99e3011a6e6f27286091a7066fe8c91683bcd1 /builtin/reflog.c
parent3e88e8fc085bbfad142d51a07ef918b9b5ca1d72 (diff)
lockfile: change lock_file::filename into a strbuf
For now, we still make sure to allocate at least PATH_MAX characters for the strbuf because resolve_symlink() doesn't know how to expand the space for its return value. (That will be fixed in a moment.) Another alternative would be to just use a strbuf as scratch space in lock_file() but then store a pointer to the naked string in struct lock_file. But lock_file objects are often reused. By reusing the same strbuf, we can avoid having to reallocate the string most times when a lock_file object is reused. Helped-by: Torsten Bögershausen <> Signed-off-by: Michael Haggerty <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin/reflog.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/reflog.c b/builtin/reflog.c
index e8a8fb1..7c78b15 100644
--- a/builtin/reflog.c
+++ b/builtin/reflog.c
@@ -431,7 +431,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
write_str_in_full(lock->lock_fd, "\n") != 1 ||
close_ref(lock) < 0)) {
status |= error("Couldn't write %s",
- lock->lk->filename);
+ lock->lk->filename.buf);
} else if (rename(newlog_path, log_file)) {
status |= error("cannot rename %s to %s",