@@ -772,13 +772,11 @@ static int sideband_demux(int in, int out, void *data)
772772 return ret ;
773773}
774774
775- static void write_promisor_file (const char * keep_name ,
776- struct ref * * sought , int nr_sought )
775+ static void create_promisor_file (const char * keep_name ,
776+ struct ref * * sought , int nr_sought )
777777{
778778 struct strbuf promisor_name = STRBUF_INIT ;
779779 int suffix_stripped ;
780- FILE * output ;
781- int i ;
782780
783781 strbuf_addstr (& promisor_name , keep_name );
784782 suffix_stripped = strbuf_strip_suffix (& promisor_name , ".keep" );
@@ -787,11 +785,7 @@ static void write_promisor_file(const char *keep_name,
787785 keep_name );
788786 strbuf_addstr (& promisor_name , ".promisor" );
789787
790- output = xfopen (promisor_name .buf , "w" );
791- for (i = 0 ; i < nr_sought ; i ++ )
792- fprintf (output , "%s %s\n" , oid_to_hex (& sought [i ]-> old_oid ),
793- sought [i ]-> name );
794- fclose (output );
788+ write_promisor_file (promisor_name .buf , sought , nr_sought );
795789
796790 strbuf_release (& promisor_name );
797791}
@@ -875,7 +869,7 @@ static int get_pack(struct fetch_pack_args *args,
875869
876870 if (args -> from_promisor )
877871 /*
878- * write_promisor_file () may be called afterwards but
872+ * create_promisor_file () may be called afterwards but
879873 * we still need index-pack to know that this is a
880874 * promisor pack. For example, if transfer.fsckobjects
881875 * is true, index-pack needs to know that .gitmodules
@@ -943,7 +937,7 @@ static int get_pack(struct fetch_pack_args *args,
943937 * obtained .keep filename if necessary
944938 */
945939 if (do_keep && pack_lockfiles && pack_lockfiles -> nr && args -> from_promisor )
946- write_promisor_file (pack_lockfiles -> items [0 ].string , sought , nr_sought );
940+ create_promisor_file (pack_lockfiles -> items [0 ].string , sought , nr_sought );
947941
948942 return 0 ;
949943}
0 commit comments