pack-write: drop always-NULL parameter
write_mtimes_file() takes an mtimes parameter as its first option, but the only caller passes a NULL constant. Drop this parameter to simplify logic. This can be reverted if that parameter is needed in the future. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
9aa1cba01a
commit
82db195e1b
13
pack-write.c
13
pack-write.c
|
@ -310,26 +310,21 @@ static void write_mtimes_trailer(struct hashfile *f, const unsigned char *hash)
|
||||||
hashwrite(f, hash, the_hash_algo->rawsz);
|
hashwrite(f, hash, the_hash_algo->rawsz);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *write_mtimes_file(const char *mtimes_name,
|
static const char *write_mtimes_file(struct packing_data *to_pack,
|
||||||
struct packing_data *to_pack,
|
|
||||||
struct pack_idx_entry **objects,
|
struct pack_idx_entry **objects,
|
||||||
uint32_t nr_objects,
|
uint32_t nr_objects,
|
||||||
const unsigned char *hash)
|
const unsigned char *hash)
|
||||||
{
|
{
|
||||||
|
struct strbuf tmp_file = STRBUF_INIT;
|
||||||
|
const char *mtimes_name;
|
||||||
struct hashfile *f;
|
struct hashfile *f;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (!to_pack)
|
if (!to_pack)
|
||||||
BUG("cannot call write_mtimes_file with NULL packing_data");
|
BUG("cannot call write_mtimes_file with NULL packing_data");
|
||||||
|
|
||||||
if (!mtimes_name) {
|
|
||||||
struct strbuf tmp_file = STRBUF_INIT;
|
|
||||||
fd = odb_mkstemp(&tmp_file, "pack/tmp_mtimes_XXXXXX");
|
fd = odb_mkstemp(&tmp_file, "pack/tmp_mtimes_XXXXXX");
|
||||||
mtimes_name = strbuf_detach(&tmp_file, NULL);
|
mtimes_name = strbuf_detach(&tmp_file, NULL);
|
||||||
} else {
|
|
||||||
unlink(mtimes_name);
|
|
||||||
fd = xopen(mtimes_name, O_CREAT|O_EXCL|O_WRONLY, 0600);
|
|
||||||
}
|
|
||||||
f = hashfd(fd, mtimes_name);
|
f = hashfd(fd, mtimes_name);
|
||||||
|
|
||||||
write_mtimes_header(f);
|
write_mtimes_header(f);
|
||||||
|
@ -561,7 +556,7 @@ void stage_tmp_packfiles(struct strbuf *name_buffer,
|
||||||
pack_idx_opts->flags);
|
pack_idx_opts->flags);
|
||||||
|
|
||||||
if (pack_idx_opts->flags & WRITE_MTIMES) {
|
if (pack_idx_opts->flags & WRITE_MTIMES) {
|
||||||
mtimes_tmp_name = write_mtimes_file(NULL, to_pack, written_list,
|
mtimes_tmp_name = write_mtimes_file(to_pack, written_list,
|
||||||
nr_written,
|
nr_written,
|
||||||
hash);
|
hash);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue