validate_packed_ref_cache(): take a `packed_ref_store *` parameter
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Jun 23, 2017 at 09:01 UTC
25e0c5faf2628e3701b1b9b783c3ca4a5653ec4d
1 file changed
+6
-7
refs/files-backend.c
+6
-7
@@ -396,12 +396,11 @@ static void files_ref_path(struct files_ref_store *refs,
396
* Check that the packed refs cache (if any) still reflects the
397
* contents of the file. If not, clear the cache.
398
*/
399
-static void validate_packed_ref_cache(struct files_ref_store *refs)
399
+static void validate_packed_ref_cache(struct packed_ref_store *refs)
400
{
401
- if (refs->packed_ref_store->cache &&
402
- !stat_validity_check(&refs->packed_ref_store->cache->validity,
403
- refs->packed_ref_store->path))
404
- clear_packed_ref_cache(refs->packed_ref_store);
401
+ if (refs->cache &&
402
+ !stat_validity_check(&refs->cache->validity, refs->path))
403
+ clear_packed_ref_cache(refs);
404
}
405
406
/*
@@ -417,7 +416,7 @@ static struct packed_ref_cache *get_packed_ref_cache(struct files_ref_store *ref
416
const char *packed_refs_file = refs->packed_ref_store->path;
417
418
if (!is_lock_file_locked(&refs->packed_ref_store->lock))
420
- validate_packed_ref_cache(refs);
419
+ validate_packed_ref_cache(refs->packed_ref_store);
420
421
if (!refs->packed_ref_store->cache)
422
refs->packed_ref_store->cache = read_packed_refs(packed_refs_file);
@@ -1364,7 +1363,7 @@ static int lock_packed_refs(struct files_ref_store *refs, int flags)
1363
* cache is still valid. We've just locked the file, but it
1364
* might have changed the moment *before* we locked it.
1365
*/
1367
- validate_packed_ref_cache(refs);
1366
+ validate_packed_ref_cache(refs->packed_ref_store);
1367
1368
packed_ref_cache = get_packed_ref_cache(refs);
1369
/* Increment the reference count to prevent it from being freed: */