Skip to content

Commit 760c451

Browse files
mhaggergitster
authored andcommitted
clear_ref_cache(): extract two new functions
Extract two new functions from clear_cached_refs(): clear_loose_ref_cache() and clear_packed_ref_cache(). Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1b7edaf commit 760c451

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

refs.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,24 @@ static void free_ref_array(struct ref_array *array)
158158
array->refs = NULL;
159159
}
160160

161-
static void clear_ref_cache(struct ref_cache *refs)
161+
static void clear_packed_ref_cache(struct ref_cache *refs)
162162
{
163-
if (refs->did_loose)
164-
free_ref_array(&refs->loose);
165163
if (refs->did_packed)
166164
free_ref_array(&refs->packed);
167-
refs->did_loose = refs->did_packed = 0;
165+
refs->did_packed = 0;
166+
}
167+
168+
static void clear_loose_ref_cache(struct ref_cache *refs)
169+
{
170+
if (refs->did_loose)
171+
free_ref_array(&refs->loose);
172+
refs->did_loose = 0;
173+
}
174+
175+
static void clear_ref_cache(struct ref_cache *refs)
176+
{
177+
clear_packed_ref_cache(refs);
178+
clear_loose_ref_cache(refs);
168179
}
169180

170181
static struct ref_cache *create_ref_cache(const char *submodule)

0 commit comments

Comments
 (0)