X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=refs.c;h=541fec20658082f13ef4b73b621787512b300ba6;hb=f0c103b49cc5957de5c332d0ca9915fdb96a26cf;hp=726c53c540a94c6ac994aa768c1ffb355ca4538e;hpb=f9b329a7d1454fba71e6a72e92aff981afdacdd4;p=~andy%2Fgit diff --git a/refs.c b/refs.c index 726c53c54..541fec206 100644 --- a/refs.c +++ b/refs.c @@ -1744,7 +1744,8 @@ static struct lock_file packlock; static int repack_without_ref(const char *refname) { struct repack_without_ref_sb data; - struct ref_dir *packed = get_packed_refs(get_ref_cache(NULL)); + struct ref_cache *refs = get_ref_cache(NULL); + struct ref_dir *packed = get_packed_refs(refs); if (find_ref(packed, refname) == NULL) return 0; data.refname = refname; @@ -1753,6 +1754,8 @@ static int repack_without_ref(const char *refname) unable_to_lock_error(git_path("packed-refs"), errno); return error("cannot delete '%s' from packed refs", refname); } + clear_packed_ref_cache(refs); + packed = get_packed_refs(refs); do_for_each_ref_in_dir(packed, 0, "", repack_without_ref_fn, 0, 0, &data); return commit_lock_file(&packlock); } @@ -1779,7 +1782,7 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt) * packed one. Also, if it was not loose we need to repack * without it. */ - ret |= repack_without_ref(refname); + ret |= repack_without_ref(lock->ref_name); unlink_or_warn(git_path("logs/%s", lock->ref_name)); invalidate_ref_cache(NULL);