Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2021-01-12 11:21:59 +0300
committerJunio C Hamano <gitster@pobox.com>2021-01-13 03:01:07 +0300
commit33add2ad7d6921489aa0cafd4a865504c3709512 (patch)
tree51acf64a6a338514574e8c4e42bae3232d277ffb /fetch-pack.c
parent9d7fa3be3145f1ad87bf5d4ddbf6ce8cb0e6a894 (diff)
fetch-pack: refactor writing promisor file
Let's replace the 2 different pieces of code that write a promisor file in 'builtin/repack.c' and 'fetch-pack.c' with a new function called 'write_promisor_file()' in 'pack-write.c' and 'pack.h'. This might also help us in the future, if we want to put back the ref names and associated hashes that were in the promisor files we are repacking in 'builtin/repack.c' as suggested by a NEEDSWORK comment just above the code we are refactoring. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fetch-pack.c')
-rw-r--r--fetch-pack.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index c5fa4992a6..1eaedcb5dc 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -777,8 +777,6 @@ static void create_promisor_file(const char *keep_name,
{
struct strbuf promisor_name = STRBUF_INIT;
int suffix_stripped;
- FILE *output;
- int i;
strbuf_addstr(&promisor_name, keep_name);
suffix_stripped = strbuf_strip_suffix(&promisor_name, ".keep");
@@ -787,11 +785,7 @@ static void create_promisor_file(const char *keep_name,
keep_name);
strbuf_addstr(&promisor_name, ".promisor");
- output = xfopen(promisor_name.buf, "w");
- for (i = 0; i < nr_sought; i++)
- fprintf(output, "%s %s\n", oid_to_hex(&sought[i]->old_oid),
- sought[i]->name);
- fclose(output);
+ write_promisor_file(promisor_name.buf, sought, nr_sought);
strbuf_release(&promisor_name);
}