diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-01-26 01:19:19 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-26 01:19:19 +0300 |
commit | 7eefa1349bcba7f4bb533f6e04f472c27b16ea83 (patch) | |
tree | 840e5a98ad9da64bb47529501e329eb3954774e2 /builtin | |
parent | 8b48981987956d7cb10c5d7cddbf08d5837bc753 (diff) | |
parent | 7c99bc23fcd69eeebf8a92263b5d90673c510a6a (diff) |
Merge branch 'cc/write-promisor-file'
A bit of code refactoring.
* cc/write-promisor-file:
pack-write: die on error in write_promisor_file()
fetch-pack: refactor writing promisor file
fetch-pack: rename helper to create_promisor_file()
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/repack.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/builtin/repack.c b/builtin/repack.c index 279be11a16..2158b48f4c 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -14,6 +14,7 @@ #include "object-store.h" #include "promisor-remote.h" #include "shallow.h" +#include "pack.h" static int delta_base_offset = 1; static int pack_kept_objects = -1; @@ -263,7 +264,7 @@ static void repack_promisor_objects(const struct pack_objects_args *args, while (strbuf_getline_lf(&line, out) != EOF) { struct string_list_item *item; char *promisor_name; - int fd; + if (line.len != the_hash_algo->hexsz) die(_("repack: Expecting full hex object ID lines only from pack-objects.")); item = string_list_append(names, line.buf); @@ -281,10 +282,7 @@ static void repack_promisor_objects(const struct pack_objects_args *args, */ promisor_name = mkpathdup("%s-%s.promisor", packtmp, line.buf); - fd = open(promisor_name, O_CREAT|O_EXCL|O_WRONLY, 0600); - if (fd < 0) - die_errno(_("unable to create '%s'"), promisor_name); - close(fd); + write_promisor_file(promisor_name, NULL, 0); item->util = (void *)(uintptr_t)populate_pack_exts(item->string); |