Skip to content

Commit f70eec8

Browse files
committed
Merge branch 'jk/repack-ref-racefix' into maint
* jk/repack-ref-racefix: refs: do not use cached refs in repack_without_ref
2 parents 8bc714b + b3f1280 commit f70eec8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

refs.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1744,7 +1744,8 @@ static struct lock_file packlock;
17441744
static int repack_without_ref(const char *refname)
17451745
{
17461746
struct repack_without_ref_sb data;
1747-
struct ref_dir *packed = get_packed_refs(get_ref_cache(NULL));
1747+
struct ref_cache *refs = get_ref_cache(NULL);
1748+
struct ref_dir *packed = get_packed_refs(refs);
17481749
if (find_ref(packed, refname) == NULL)
17491750
return 0;
17501751
data.refname = refname;
@@ -1753,6 +1754,8 @@ static int repack_without_ref(const char *refname)
17531754
unable_to_lock_error(git_path("packed-refs"), errno);
17541755
return error("cannot delete '%s' from packed refs", refname);
17551756
}
1757+
clear_packed_ref_cache(refs);
1758+
packed = get_packed_refs(refs);
17561759
do_for_each_ref_in_dir(packed, 0, "", repack_without_ref_fn, 0, 0, &data);
17571760
return commit_lock_file(&packlock);
17581761
}

0 commit comments

Comments
 (0)