]> git.ipfire.org Git - thirdparty/git.git/blobdiff - fetch-pack.c
The tenth batch
[thirdparty/git.git] / fetch-pack.c
index 876f90c759a09334bb4a47575c236d27f2887b98..1eaedcb5dc2ed45e18e29bf185958a663f89eccb 100644 (file)
@@ -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;
 }