create_tmp_packfile(): a helper function
Factor out a small logic out of the private write_pack_file() function in builtin/pack-objects.c Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
@ -584,16 +584,10 @@ static void write_pack_file(void)
|
||||
unsigned char sha1[20];
|
||||
char *pack_tmp_name = NULL;
|
||||
|
||||
if (pack_to_stdout) {
|
||||
if (pack_to_stdout)
|
||||
f = sha1fd_throughput(1, "<stdout>", progress_state);
|
||||
} else {
|
||||
char tmpname[PATH_MAX];
|
||||
int fd;
|
||||
fd = odb_mkstemp(tmpname, sizeof(tmpname),
|
||||
"pack/tmp_pack_XXXXXX");
|
||||
pack_tmp_name = xstrdup(tmpname);
|
||||
f = sha1fd(fd, pack_tmp_name);
|
||||
}
|
||||
else
|
||||
f = create_tmp_packfile(&pack_tmp_name);
|
||||
|
||||
offset = write_pack_header(f, nr_remaining);
|
||||
if (!offset)
|
||||
|
||||
Reference in New Issue
Block a user