@matheusbsbs / matheus-bagliano / commits / 8b4eb6b6cd
Fork 0

Do not perform cross-directory renames when creating packs

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>

Petr Baudis committed Sep 22, 2008 at 19:20 UTC 8b4eb6b6cd65042c6ecb4f06f19c1f2441899ed6
4 files changed +5 -5
builtin-pack-objects.c
+1 -1
@@ -465,7 +465,7 @@ static void write_pack_file(void)
465 char tmpname[PATH_MAX];
466 int fd;
467 snprintf(tmpname, sizeof(tmpname),
468 - "%s/tmp_pack_XXXXXX", get_object_directory());
468 + "%s/pack/tmp_pack_XXXXXX", get_object_directory());
469 fd = xmkstemp(tmpname);
470 pack_tmp_name = xstrdup(tmpname);
471 f = sha1fd(fd, pack_tmp_name);
fast-import.c
+2 -2
@@ -816,7 +816,7 @@ static void start_packfile(void)
816 int pack_fd;
817
818 snprintf(tmpfile, sizeof(tmpfile),
819 - "%s/tmp_pack_XXXXXX", get_object_directory());
819 + "%s/pack/tmp_pack_XXXXXX", get_object_directory());
820 pack_fd = xmkstemp(tmpfile);
821 p = xcalloc(1, sizeof(*p) + strlen(tmpfile) + 2);
822 strcpy(p->pack_name, tmpfile);
@@ -878,7 +878,7 @@ static char *create_index(void)
878 }
879
880 snprintf(tmpfile, sizeof(tmpfile),
881 - "%s/tmp_idx_XXXXXX", get_object_directory());
881 + "%s/pack/tmp_idx_XXXXXX", get_object_directory());
882 idx_fd = xmkstemp(tmpfile);
883 f = sha1fd(idx_fd, tmpfile);
884 sha1write(f, array, 256 * sizeof(int));
index-pack.c
+1 -1
@@ -172,7 +172,7 @@ static char *open_pack_file(char *pack_name)
172 if (!pack_name) {
173 static char tmpfile[PATH_MAX];
174 snprintf(tmpfile, sizeof(tmpfile),
175 - "%s/tmp_pack_XXXXXX", get_object_directory());
175 + "%s/pack/tmp_pack_XXXXXX", get_object_directory());
176 output_fd = xmkstemp(tmpfile);
177 pack_name = xstrdup(tmpfile);
178 } else
pack-write.c
+1 -1
@@ -45,7 +45,7 @@ char *write_idx_file(char *index_name, struct pack_idx_entry **objects,
45 if (!index_name) {
46 static char tmpfile[PATH_MAX];
47 snprintf(tmpfile, sizeof(tmpfile),
48 - "%s/tmp_idx_XXXXXX", get_object_directory());
48 + "%s/pack/tmp_idx_XXXXXX", get_object_directory());
49 fd = xmkstemp(tmpfile);
50 index_name = xstrdup(tmpfile);
51 } else {