@@ -493,9 +493,8 @@ static char *pool_strdup(const char *s)
493
493
return r ;
494
494
}
495
495
496
- static void insert_mark (uintmax_t idnum , struct object_entry * oe )
496
+ static void insert_mark (struct mark_set * s , uintmax_t idnum , struct object_entry * oe )
497
497
{
498
- struct mark_set * s = marks ;
499
498
while ((idnum >> s -> shift ) >= 1024 ) {
500
499
s = mem_pool_calloc (& fi_mem_pool , 1 , sizeof (struct mark_set ));
501
500
s -> shift = marks -> shift + 10 ;
@@ -919,7 +918,7 @@ static int store_object(
919
918
920
919
e = insert_object (& oid );
921
920
if (mark )
922
- insert_mark (mark , e );
921
+ insert_mark (marks , mark , e );
923
922
if (e -> idx .offset ) {
924
923
duplicate_count_by_type [type ]++ ;
925
924
return 1 ;
@@ -1117,7 +1116,7 @@ static void stream_blob(uintmax_t len, struct object_id *oidout, uintmax_t mark)
1117
1116
e = insert_object (& oid );
1118
1117
1119
1118
if (mark )
1120
- insert_mark (mark , e );
1119
+ insert_mark (marks , mark , e );
1121
1120
1122
1121
if (e -> idx .offset ) {
1123
1122
duplicate_count_by_type [OBJ_BLOB ]++ ;
@@ -1712,16 +1711,9 @@ static void dump_marks(void)
1712
1711
}
1713
1712
}
1714
1713
1715
- static void read_marks ( void )
1714
+ static void read_mark_file ( struct mark_set * s , FILE * f )
1716
1715
{
1717
1716
char line [512 ];
1718
- FILE * f = fopen (import_marks_file , "r" );
1719
- if (f )
1720
- ;
1721
- else if (import_marks_file_ignore_missing && errno == ENOENT )
1722
- goto done ; /* Marks file does not exist */
1723
- else
1724
- die_errno ("cannot read '%s'" , import_marks_file );
1725
1717
while (fgets (line , sizeof (line ), f )) {
1726
1718
uintmax_t mark ;
1727
1719
char * end ;
@@ -1747,8 +1739,20 @@ static void read_marks(void)
1747
1739
e -> pack_id = MAX_PACK_ID ;
1748
1740
e -> idx .offset = 1 ; /* just not zero! */
1749
1741
}
1750
- insert_mark (mark , e );
1742
+ insert_mark (s , mark , e );
1751
1743
}
1744
+ }
1745
+
1746
+ static void read_marks (void )
1747
+ {
1748
+ FILE * f = fopen (import_marks_file , "r" );
1749
+ if (f )
1750
+ ;
1751
+ else if (import_marks_file_ignore_missing && errno == ENOENT )
1752
+ goto done ; /* Marks file does not exist */
1753
+ else
1754
+ die_errno ("cannot read '%s'" , import_marks_file );
1755
+ read_mark_file (marks , f );
1752
1756
fclose (f );
1753
1757
done :
1754
1758
import_marks_file_done = 1 ;
@@ -3130,7 +3134,7 @@ static void parse_alias(void)
3130
3134
die (_ ("Expected 'to' command, got %s" ), command_buf .buf );
3131
3135
e = find_object (& b .oid );
3132
3136
assert (e );
3133
- insert_mark (next_mark , e );
3137
+ insert_mark (marks , next_mark , e );
3134
3138
}
3135
3139
3136
3140
static char * make_fast_import_path (const char * path )
0 commit comments