mirror of
https://github.com/git/git.git
synced 2026-01-09 01:34:00 +00:00
odb: get rid of the_repository in odb_mkstemp()
Get rid of our dependency on `the_repository` in `odb_mkstemp()` by passing in the object database as a parameter and adjusting all callers. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
961038856b
commit
1b1679c688
10
pack-write.c
10
pack-write.c
@@ -84,7 +84,8 @@ const char *write_idx_file(struct repository *repo,
|
||||
} else {
|
||||
if (!index_name) {
|
||||
struct strbuf tmp_file = STRBUF_INIT;
|
||||
fd = odb_mkstemp(&tmp_file, "pack/tmp_idx_XXXXXX");
|
||||
fd = odb_mkstemp(repo->objects, &tmp_file,
|
||||
"pack/tmp_idx_XXXXXX");
|
||||
index_name = strbuf_detach(&tmp_file, NULL);
|
||||
} else {
|
||||
unlink(index_name);
|
||||
@@ -259,7 +260,8 @@ char *write_rev_file_order(struct repository *repo,
|
||||
if (flags & WRITE_REV) {
|
||||
if (!rev_name) {
|
||||
struct strbuf tmp_file = STRBUF_INIT;
|
||||
fd = odb_mkstemp(&tmp_file, "pack/tmp_rev_XXXXXX");
|
||||
fd = odb_mkstemp(repo->objects, &tmp_file,
|
||||
"pack/tmp_rev_XXXXXX");
|
||||
path = strbuf_detach(&tmp_file, NULL);
|
||||
} else {
|
||||
unlink(rev_name);
|
||||
@@ -342,7 +344,7 @@ static char *write_mtimes_file(struct repository *repo,
|
||||
if (!to_pack)
|
||||
BUG("cannot call write_mtimes_file with NULL packing_data");
|
||||
|
||||
fd = odb_mkstemp(&tmp_file, "pack/tmp_mtimes_XXXXXX");
|
||||
fd = odb_mkstemp(repo->objects, &tmp_file, "pack/tmp_mtimes_XXXXXX");
|
||||
mtimes_name = strbuf_detach(&tmp_file, NULL);
|
||||
f = hashfd(repo->hash_algo, fd, mtimes_name);
|
||||
|
||||
@@ -531,7 +533,7 @@ struct hashfile *create_tmp_packfile(struct repository *repo,
|
||||
struct strbuf tmpname = STRBUF_INIT;
|
||||
int fd;
|
||||
|
||||
fd = odb_mkstemp(&tmpname, "pack/tmp_pack_XXXXXX");
|
||||
fd = odb_mkstemp(repo->objects, &tmpname, "pack/tmp_pack_XXXXXX");
|
||||
*pack_tmp_name = strbuf_detach(&tmpname, NULL);
|
||||
return hashfd(repo->hash_algo, fd, *pack_tmp_name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user