summaryrefslogtreecommitdiff
path: root/fetch-pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'fetch-pack.c')
-rw-r--r--fetch-pack.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index 876f90c759..1eaedcb5dc 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -772,13 +772,11 @@ static int sideband_demux(int in, int out, void *data)
return ret;
}
-static void write_promisor_file(const char *keep_name,
- struct ref **sought, int nr_sought)
+static void create_promisor_file(const char *keep_name,
+ struct ref **sought, int nr_sought)
{
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 write_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);
}
@@ -875,7 +869,7 @@ static int get_pack(struct fetch_pack_args *args,
if (args->from_promisor)
/*
- * write_promisor_file() may be called afterwards but
+ * create_promisor_file() may be called afterwards but
* we still need index-pack to know that this is a
* promisor pack. For example, if transfer.fsckobjects
* is true, index-pack needs to know that .gitmodules
@@ -943,7 +937,7 @@ static int get_pack(struct fetch_pack_args *args,
* obtained .keep filename if necessary
*/
if (do_keep && pack_lockfiles && pack_lockfiles->nr && args->from_promisor)
- write_promisor_file(pack_lockfiles->items[0].string, sought, nr_sought);
+ create_promisor_file(pack_lockfiles->items[0].string, sought, nr_sought);
return 0;
}