config: don't implicitly use gitdir or commondir
[gitweb.git] / fast-import.c
index f6f416f20a9f4c05f90690fcd7bfe049a8c91467..bbc3e79eaf8ea5cb4d2bf56b530b610193e87924 100644 (file)
@@ -154,6 +154,7 @@ Format of STDIN stream:
 
 #include "builtin.h"
 #include "cache.h"
+#include "config.h"
 #include "lockfile.h"
 #include "object.h"
 #include "blob.h"
@@ -890,14 +891,15 @@ static struct tree_content *dup_tree_content(struct tree_content *s)
 
 static void start_packfile(void)
 {
-       static char tmp_file[PATH_MAX];
+       struct strbuf tmp_file = STRBUF_INIT;
        struct packed_git *p;
        struct pack_header hdr;
        int pack_fd;
 
-       pack_fd = odb_mkstemp(tmp_file, sizeof(tmp_file),
-                             "pack/tmp_pack_XXXXXX");
-       FLEX_ALLOC_STR(p, pack_name, tmp_file);
+       pack_fd = odb_mkstemp(&tmp_file, "pack/tmp_pack_XXXXXX");
+       FLEX_ALLOC_STR(p, pack_name, tmp_file.buf);
+       strbuf_release(&tmp_file);
+
        p->pack_fd = pack_fd;
        p->do_not_close = 1;
        pack_file = sha1fd(pack_fd, p->pack_name);
@@ -3201,7 +3203,7 @@ static char* make_fast_import_path(const char *path)
 {
        if (!relative_marks_paths || is_absolute_path(path))
                return xstrdup(path);
-       return xstrdup(git_path("info/fast-import/%s", path));
+       return git_pathdup("info/fast-import/%s", path);
 }
 
 static void option_import_marks(const char *marks,