Skip to content

Commit 25e0c5f

Browse files
mhaggergitster
authored andcommitted
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>
1 parent 9c4fe0f commit 25e0c5f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

refs/files-backend.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,11 @@ static void files_ref_path(struct files_ref_store *refs,
396396
* Check that the packed refs cache (if any) still reflects the
397397
* contents of the file. If not, clear the cache.
398398
*/
399-
static void validate_packed_ref_cache(struct files_ref_store *refs)
399+
static void validate_packed_ref_cache(struct packed_ref_store *refs)
400400
{
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);
405404
}
406405

407406
/*
@@ -417,7 +416,7 @@ static struct packed_ref_cache *get_packed_ref_cache(struct files_ref_store *ref
417416
const char *packed_refs_file = refs->packed_ref_store->path;
418417

419418
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);
421420

422421
if (!refs->packed_ref_store->cache)
423422
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)
13641363
* cache is still valid. We've just locked the file, but it
13651364
* might have changed the moment *before* we locked it.
13661365
*/
1367-
validate_packed_ref_cache(refs);
1366+
validate_packed_ref_cache(refs->packed_ref_store);
13681367

13691368
packed_ref_cache = get_packed_ref_cache(refs);
13701369
/* Increment the reference count to prevent it from being freed: */

0 commit comments

Comments
 (0)