diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-10-28 11:52:14 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-10-28 11:52:14 -0700 |
commit | cdf9db3c83618453809d6a584d1a0db19b3e189f (patch) | |
tree | dae91f3adac1efa60acfc501c1b9adf16b79156d /builtin/pack-objects.c | |
parent | write_pack_header(): a helper function (diff) | |
download | tgif-cdf9db3c83618453809d6a584d1a0db19b3e189f.tar.xz |
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>
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r-- | builtin/pack-objects.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 6643c1657a..3258fa96e8 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -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) |