diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-02-25 14:48:30 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-02-25 14:50:05 -0800 |
commit | bb0cebd7d0ac9bf2ddf94fe5579603819c4a1fc7 (patch) | |
tree | 1fdfa7e92aa0290bacfb64d77aad894d9915785a /fast-import.c | |
parent | Allow HTTP tests to run on Darwin (diff) | |
parent | Make sure objects/pack exists before creating a new pack (diff) | |
download | tgif-bb0cebd7d0ac9bf2ddf94fe5579603819c4a1fc7.tar.xz |
Merge branch 'jc/maint-1.6.0-pack-directory'
* jc/maint-1.6.0-pack-directory:
Make sure objects/pack exists before creating a new pack
Diffstat (limited to 'fast-import.c')
-rw-r--r-- | fast-import.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/fast-import.c b/fast-import.c index 3ef3413e69..3748ddf48d 100644 --- a/fast-import.c +++ b/fast-import.c @@ -817,9 +817,8 @@ static void start_packfile(void) struct pack_header hdr; int pack_fd; - snprintf(tmpfile, sizeof(tmpfile), - "%s/pack/tmp_pack_XXXXXX", get_object_directory()); - pack_fd = xmkstemp(tmpfile); + pack_fd = odb_mkstemp(tmpfile, sizeof(tmpfile), + "pack/tmp_pack_XXXXXX"); p = xcalloc(1, sizeof(*p) + strlen(tmpfile) + 2); strcpy(p->pack_name, tmpfile); p->pack_fd = pack_fd; @@ -879,9 +878,8 @@ static char *create_index(void) c = next; } - snprintf(tmpfile, sizeof(tmpfile), - "%s/pack/tmp_idx_XXXXXX", get_object_directory()); - idx_fd = xmkstemp(tmpfile); + idx_fd = odb_mkstemp(tmpfile, sizeof(tmpfile), + "pack/tmp_idx_XXXXXX"); f = sha1fd(idx_fd, tmpfile); sha1write(f, array, 256 * sizeof(int)); git_SHA1_Init(&ctx); @@ -907,9 +905,7 @@ static char *keep_pack(char *curr_index_name) chmod(pack_data->pack_name, 0444); chmod(curr_index_name, 0444); - snprintf(name, sizeof(name), "%s/pack/pack-%s.keep", - get_object_directory(), sha1_to_hex(pack_data->sha1)); - keep_fd = open(name, O_RDWR|O_CREAT|O_EXCL, 0600); + keep_fd = odb_pack_keep(name, sizeof(name), pack_data->sha1); if (keep_fd < 0) die("cannot create keep file"); write_or_die(keep_fd, keep_msg, strlen(keep_msg)); |