Commit afd11d3e authored by Committed by Junio C Hamano
pack-refs: prune top-level refs like "refs/foo"
After we have packed all refs, we prune any loose refs that correspond to what we packed. We do so by first taking a lock with lock_ref_sha1, and then deleting the loose ref file. However, lock_ref_sha1 will refuse to take a lock on any refs that exist at the top-level of the "refs/" directory, and we skip pruning the ref. This is almost certainly not what we want to happen here. The criteria to be pruned should not differ from that to be packed; if a ref makes it to prune_ref, it's because we want it both packed and pruned (if there are refs you do not want to be packed, they should be omitted much earlier by pack_ref_is_possible, which we do in this case if --all is not given). We can fix this by switching to lock_any_ref_for_update. This behaves exactly the same with the exception of this top-level check. Signed-off-by: Jeff King <firstname.lastname@example.org> Reviewed-by: Michael Haggerty <email@example.com> Reviewed-by: Ronnie Sahlberg <firstname.lastname@example.org> Signed-off-by: Junio C Hamano <email@example.com>
Showing with 9 additions and 1 deletion