reflog: avoid constructing .lock path with git_path
[gitweb.git] / builtin / reflog.c
index e8a8fb13b9ffc8d3276048131e33e9874bc3bdea..fb07c667a87b19a74a5ef0104a1b3cac1e92f7a8 100644 (file)
@@ -1,5 +1,5 @@
-#include "cache.h"
 #include "builtin.h"
+#include "lockfile.h"
 #include "commit.h"
 #include "refs.h"
 #include "dir.h"
@@ -372,7 +372,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
        if (!reflog_exists(ref))
                goto finish;
        if (!cmd->dry_run) {
-               newlog_path = git_pathdup("logs/%s.lock", ref);
+               newlog_path = mkpathdup("%s.lock", log_file);
                cb.newlog = fopen(newlog_path, "w");
        }
 
@@ -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",
@@ -649,7 +649,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
                init_revisions(&cb.revs, prefix);
                if (cb.verbose)
                        printf("Marking reachable objects...");
-               mark_reachable_objects(&cb.revs, 0, NULL);
+               mark_reachable_objects(&cb.revs, 0, 0, NULL);
                if (cb.verbose)
                        putchar('\n');
        }