lockfile.h: extract new header file for the functions in lockfile.c
[gitweb.git] / builtin / reflog.c
index c12a9784e6b45d50129b786a45bb5f4e4dd0801a..b6388f75b0cffcce03b9eee03be966ce67806310 100644 (file)
@@ -1,5 +1,5 @@
-#include "cache.h"
 #include "builtin.h"
+#include "lockfile.h"
 #include "commit.h"
 #include "refs.h"
 #include "dir.h"
@@ -369,7 +369,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
        if (!lock)
                return error("cannot lock ref '%s'", ref);
        log_file = git_pathdup("logs/%s", ref);
-       if (!file_exists(log_file))
+       if (!reflog_exists(ref))
                goto finish;
        if (!cmd->dry_run) {
                newlog_path = git_pathdup("logs/%s.lock", ref);
@@ -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);
                        unlink(newlog_path);
                } else if (rename(newlog_path, log_file)) {
                        status |= error("cannot rename %s to %s",