Skip to content

Commit 8b4eb6b

Browse files
Petr Baudisgitster
authored andcommitted
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 <[email protected]> Acked-by: Linus Torvalds <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 18309f4 commit 8b4eb6b

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

builtin-pack-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ static void write_pack_file(void)
465465
char tmpname[PATH_MAX];
466466
int fd;
467467
snprintf(tmpname, sizeof(tmpname),
468-
"%s/tmp_pack_XXXXXX", get_object_directory());
468+
"%s/pack/tmp_pack_XXXXXX", get_object_directory());
469469
fd = xmkstemp(tmpname);
470470
pack_tmp_name = xstrdup(tmpname);
471471
f = sha1fd(fd, pack_tmp_name);

fast-import.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ static void start_packfile(void)
816816
int pack_fd;
817817

818818
snprintf(tmpfile, sizeof(tmpfile),
819-
"%s/tmp_pack_XXXXXX", get_object_directory());
819+
"%s/pack/tmp_pack_XXXXXX", get_object_directory());
820820
pack_fd = xmkstemp(tmpfile);
821821
p = xcalloc(1, sizeof(*p) + strlen(tmpfile) + 2);
822822
strcpy(p->pack_name, tmpfile);
@@ -878,7 +878,7 @@ static char *create_index(void)
878878
}
879879

880880
snprintf(tmpfile, sizeof(tmpfile),
881-
"%s/tmp_idx_XXXXXX", get_object_directory());
881+
"%s/pack/tmp_idx_XXXXXX", get_object_directory());
882882
idx_fd = xmkstemp(tmpfile);
883883
f = sha1fd(idx_fd, tmpfile);
884884
sha1write(f, array, 256 * sizeof(int));

index-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static char *open_pack_file(char *pack_name)
172172
if (!pack_name) {
173173
static char tmpfile[PATH_MAX];
174174
snprintf(tmpfile, sizeof(tmpfile),
175-
"%s/tmp_pack_XXXXXX", get_object_directory());
175+
"%s/pack/tmp_pack_XXXXXX", get_object_directory());
176176
output_fd = xmkstemp(tmpfile);
177177
pack_name = xstrdup(tmpfile);
178178
} else

pack-write.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ char *write_idx_file(char *index_name, struct pack_idx_entry **objects,
4545
if (!index_name) {
4646
static char tmpfile[PATH_MAX];
4747
snprintf(tmpfile, sizeof(tmpfile),
48-
"%s/tmp_idx_XXXXXX", get_object_directory());
48+
"%s/pack/tmp_idx_XXXXXX", get_object_directory());
4949
fd = xmkstemp(tmpfile);
5050
index_name = xstrdup(tmpfile);
5151
} else {

0 commit comments

Comments
 (0)