Code

Do not perform cross-directory renames when creating packs
authorPetr Baudis <pasky@suse.cz>
Mon, 22 Sep 2008 17:20:21 +0000 (19:20 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Sep 2008 19:19:14 +0000 (12:19 -0700)
A comment on top of create_tmpfile() describes caveats ('can have
problems on various systems (FAT, NFS, Coda)') that should apply
in this situation as well.  This in the end did not end up solving
any of my personal problems, but it might be a useful cleanup patch
nevertheless.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-pack-objects.c
fast-import.c
index-pack.c
pack-write.c

index 217fd49da9ad98e660e6522024793ae3a357e837..4004e73e40db210334fa3ef69b49d07b929f2c99 100644 (file)
@@ -465,7 +465,7 @@ static void write_pack_file(void)
                        char tmpname[PATH_MAX];
                        int fd;
                        snprintf(tmpname, sizeof(tmpname),
-                                "%s/tmp_pack_XXXXXX", get_object_directory());
+                                "%s/pack/tmp_pack_XXXXXX", get_object_directory());
                        fd = xmkstemp(tmpname);
                        pack_tmp_name = xstrdup(tmpname);
                        f = sha1fd(fd, pack_tmp_name);
index d85b3a561f511bfa7db0232c43a8088c0df8ae27..5473cd4d626c1260cf1a192ab05cc63c37a8fbcb 100644 (file)
@@ -816,7 +816,7 @@ static void start_packfile(void)
        int pack_fd;
 
        snprintf(tmpfile, sizeof(tmpfile),
-               "%s/tmp_pack_XXXXXX", get_object_directory());
+               "%s/pack/tmp_pack_XXXXXX", get_object_directory());
        pack_fd = xmkstemp(tmpfile);
        p = xcalloc(1, sizeof(*p) + strlen(tmpfile) + 2);
        strcpy(p->pack_name, tmpfile);
@@ -878,7 +878,7 @@ static char *create_index(void)
        }
 
        snprintf(tmpfile, sizeof(tmpfile),
-               "%s/tmp_idx_XXXXXX", get_object_directory());
+               "%s/pack/tmp_idx_XXXXXX", get_object_directory());
        idx_fd = xmkstemp(tmpfile);
        f = sha1fd(idx_fd, tmpfile);
        sha1write(f, array, 256 * sizeof(int));
index a6e91fe3ba47e3b0837648180bb7d47acd3e7dc7..530d820370fb2b02a443873b8b9ddd0bcffcb5ec 100644 (file)
@@ -172,7 +172,7 @@ static char *open_pack_file(char *pack_name)
                if (!pack_name) {
                        static char tmpfile[PATH_MAX];
                        snprintf(tmpfile, sizeof(tmpfile),
-                                "%s/tmp_pack_XXXXXX", get_object_directory());
+                                "%s/pack/tmp_pack_XXXXXX", get_object_directory());
                        output_fd = xmkstemp(tmpfile);
                        pack_name = xstrdup(tmpfile);
                } else
index 939ed56362d3c29bfc64e8cca91032df9a57961e..3621f1dd3258d9dcd63bf5a6738e5d54940ffbbb 100644 (file)
@@ -45,7 +45,7 @@ char *write_idx_file(char *index_name, struct pack_idx_entry **objects,
        if (!index_name) {
                static char tmpfile[PATH_MAX];
                snprintf(tmpfile, sizeof(tmpfile),
-                        "%s/tmp_idx_XXXXXX", get_object_directory());
+                        "%s/pack/tmp_idx_XXXXXX", get_object_directory());
                fd = xmkstemp(tmpfile);
                index_name = xstrdup(tmpfile);
        } else {