lock_ref_sha1_basic: always fill old_oid while holding lock