shlib: add and use clear_stale_ref_locks function
If git is killed during a ref update operation, it may leave behind
a ref lock file.
Add a new clear_stale_ref_locks function to find and remove
any of these stale left-behind *.lock files.
Call clear_stale_ref_locks as part of the "remove_crud" operation
durin gc, part of the cleanup operation when restarting a failed
clone and as part of the cleanup operation before doing a mirror
update.
Since Girocco now makes it a point to (mostly) maintain refs in
a packed state, the check and removal will always be relatively
quick and cheap to do.
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>