@@ -44,7 +44,7 @@ static int entry_resolves_to_object(struct ref_entry *entry)
44
44
}
45
45
46
46
struct packed_ref_cache {
47
- struct ref_entry * root ;
47
+ struct ref_cache * cache ;
48
48
49
49
/*
50
50
* Count of references to the data structure in this instance,
@@ -79,7 +79,7 @@ struct files_ref_store {
79
79
char * gitcommondir ;
80
80
char * packed_refs_path ;
81
81
82
- struct ref_entry * loose ;
82
+ struct ref_cache * loose ;
83
83
struct packed_ref_cache * packed ;
84
84
};
85
85
@@ -101,7 +101,7 @@ static void acquire_packed_ref_cache(struct packed_ref_cache *packed_refs)
101
101
static int release_packed_ref_cache (struct packed_ref_cache * packed_refs )
102
102
{
103
103
if (!-- packed_refs -> referrers ) {
104
- free_ref_entry (packed_refs -> root );
104
+ free_ref_cache (packed_refs -> cache );
105
105
stat_validity_clear (& packed_refs -> validity );
106
106
free (packed_refs );
107
107
return 1 ;
@@ -125,7 +125,7 @@ static void clear_packed_ref_cache(struct files_ref_store *refs)
125
125
static void clear_loose_ref_cache (struct files_ref_store * refs )
126
126
{
127
127
if (refs -> loose ) {
128
- free_ref_entry (refs -> loose );
128
+ free_ref_cache (refs -> loose );
129
129
refs -> loose = NULL ;
130
130
}
131
131
}
@@ -386,11 +386,12 @@ static struct packed_ref_cache *get_packed_ref_cache(struct files_ref_store *ref
386
386
387
387
refs -> packed = xcalloc (1 , sizeof (* refs -> packed ));
388
388
acquire_packed_ref_cache (refs -> packed );
389
- refs -> packed -> root = create_dir_entry (refs , "" , 0 , 0 );
389
+ refs -> packed -> cache = create_ref_cache (refs );
390
+ refs -> packed -> cache -> root -> flag &= ~REF_INCOMPLETE ;
390
391
f = fopen (packed_refs_file , "r" );
391
392
if (f ) {
392
393
stat_validity_update (& refs -> packed -> validity , fileno (f ));
393
- read_packed_refs (f , get_ref_dir (refs -> packed -> root ));
394
+ read_packed_refs (f , get_ref_dir (refs -> packed -> cache -> root ));
394
395
fclose (f );
395
396
}
396
397
}
@@ -399,7 +400,7 @@ static struct packed_ref_cache *get_packed_ref_cache(struct files_ref_store *ref
399
400
400
401
static struct ref_dir * get_packed_ref_dir (struct packed_ref_cache * packed_ref_cache )
401
402
{
402
- return get_ref_dir (packed_ref_cache -> root );
403
+ return get_ref_dir (packed_ref_cache -> cache -> root );
403
404
}
404
405
405
406
static struct ref_dir * get_packed_refs (struct files_ref_store * refs )
@@ -514,14 +515,19 @@ static struct ref_dir *get_loose_refs(struct files_ref_store *refs)
514
515
* are about to read the only subdirectory that can
515
516
* hold references:
516
517
*/
517
- refs -> loose = create_dir_entry (refs , "" , 0 , 0 );
518
+ refs -> loose = create_ref_cache (refs );
519
+
520
+ /* We're going to fill the top level ourselves: */
521
+ refs -> loose -> root -> flag &= ~REF_INCOMPLETE ;
522
+
518
523
/*
519
- * Create an incomplete entry for "refs/":
524
+ * Add an incomplete entry for "refs/" (to be filled
525
+ * lazily):
520
526
*/
521
- add_entry_to_dir (get_ref_dir (refs -> loose ),
527
+ add_entry_to_dir (get_ref_dir (refs -> loose -> root ),
522
528
create_dir_entry (refs , "refs/" , 5 , 1 ));
523
529
}
524
- return get_ref_dir (refs -> loose );
530
+ return get_ref_dir (refs -> loose -> root );
525
531
}
526
532
527
533
/*
0 commit comments