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 <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Oct 17, 2011 at 04:38 UTC
760c4512e54e524e3a19905c10a65209fda20c12
1 file changed
+15
-4
refs.c
+15
-4
@@ -158,13 +158,24 @@ static void free_ref_array(struct ref_array *array)
158
array->refs = NULL;
159
}
160
161
-static void clear_ref_cache(struct ref_cache *refs)
161
+static void clear_packed_ref_cache(struct ref_cache *refs)
162
{
163
- if (refs->did_loose)
164
- free_ref_array(&refs->loose);
163
if (refs->did_packed)
164
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);
179
}
180
181
static struct ref_cache *create_ref_cache(const char *submodule)